https://www.acmicpc.net/problem/2581
#include<stdio.h>
int main() {
int m,n;
scanf("%d %d",&m,&n);
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) printf("-1");
else{
printf("%d\n",sum);
printf("%d",min);
}
}