require "prime" puts (1..(gets.to_i)).filter{|x| Prime.prime?(x) }.sum