https://www.acmicpc.net/problem/2581
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int m=s.nextInt();
int n=s.nextInt();
int min=10000;
int sum=0;
int count=0;
for(int i=m;i<=n;i++){
if(i==1) count=1;
for(int j=2;j<i;j++){
if(i%j==0) count=1;
}
if(count==0){
sum+=i;
if(i<=min) min=i;
}
count=0;
}
if(sum==0) System.out.print("-1");
else{
System.out.println(sum);
System.out.print(min);
}
}
}