#include
void main() { int i,j,b,s,n;
scanf("%d",&n); s=0;
for ( i=2;i<=n;i++ ) {
b=1; for ( j=2;j<=i/2;j++ ) if ( i%j==0 ) { b=0;break; }
if ( b!=0 ) s+=i*i;
}
printf("%d\n",s);