/*
*//*
#include<stdio.h>
int main()
{
int b=0,ho=0, mi=0, ot=0,i,j,f=0,h=0;
scanf("%d %d %d", &ho, &mi, &ot);
mi += ot;
//ho시 mi분
ho = ho + mi/60;
mi=mi%60;
printf("%d %d",ho%24,mi);
return 0;
}
*/
#include<stdio.h>
int main()
{
int m,n,i,j,g,s,h=0,im=10000;
scanf("%d %d",&m,&n);
for(i=m;i<=n;i++)
{
s=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
{
s+=1;
}
}
if(s==2)
{
h+=i;
if(im>i)
{
im=i;
}
}
}
if(h==0)
{
h=h-h-1;
}
printf("%d\n%d",h,im);
return 0;
}



