// The "Question2" class.
import java.awt.*;
import java.io.*;
import java.lang.*;

public class Question2Copy2
{
    public static void main (String[] args) throws IOException, NumberFormatException
    {

	BufferedReader in = new BufferedReader (new FileReader ("DATA2.txt"));
	PrintWriter out = new PrintWriter (new BufferedWriter (new FileWriter ("OUT2.txt")));
	String a1;
	int oNum, counter = 0;

	for (int i = 1 ; i <= 5 ; i++)
	{
	    a1 = in.readLine ();

	    oNum = Integer.parseInt (a1);

	    int x, j;

	    if (oNum <= 50000)
	    //{
	     //   out.println ("454396537");
	   // }
	    //else
	    {
		for (x = 2 ; x <= oNum ; x++)
		{
		    for (j = 2 ; j < x ; j++)
		    {
			if ((x % j) == 0)
			{
			    break;
			}
		    }
		    if (x == j)
		    {
			counter += x;
		    }
		}
	    }
	    out.println (counter);
	    a1 = "";
	    oNum = 0;
	    counter = 0;
	}

	out.close ();

    } // main method
} // Question1 class

