/*
template   Dwite_IN_out_java.java
*/
import java.io.*;
import java.util.*;

class Dwite {
  public static void main (String [] args) throws IOException {
	String s= "";
	int[] get;
	int[] out;
	int get1, out1;
	int a=0;
	int b=0;
	get1 = 5;
	out1 = 5;
	get = new int[get1];
	out = new int[out1];
    // Use BufferedReader rather than RandomAccessFile; it's much faster
    BufferedReader f = new BufferedReader(new FileReader("DATA2.txt"));
                                                  // input file name goes above
    PrintWriter out2 = new PrintWriter(new BufferedWriter(new FileWriter("OUT2.txt")));
	
	for(int i= 0; i <get1; i ++){
		s = f.readLine();
		int fr_num = Integer.parseInt(s);
		get[i] = fr_num; 

		out[i] = isPrimeb(get[i]);

		
		
	}
	
  //  int fr_num = Integer.parseInt(s);
 // out 
	for(int i= 0; i <get1; i ++){
		out2.write(""+  out[i]  + "\n" );  // gets entire line
	}
    


    f.close();
    out2.close();                                  // close the output file
    System.exit(0);                               // don't omit this!

  
   } // end main
   
   	public static int isPrimeb(int input){// 1 b
	int outPut = 0;
	int int_count = 0; // simular methods
	int j =0; // count the number times displated

	
		do{ // for loop stops when reach the number
		
			int_count = 0;
			if (j == 2)
				int_count = 0;// prime
			else if(j <= 1 || j % 2 == 0) // if even display not prime and also one
				int_count = 1; // not prime
			else {
				for(int i = 2; i <(int)(Math.sqrt(j))+0.01; i++ ){ // display by caluclating 
					if (j%i == 0)
						int_count++;
				}
			}
			if (int_count >= 1);
			else {
				outPut = outPut + j;
				
			}
			j++;
		}while(j<=input);
		return(outPut);
	}




}//end class
