require 'prime'
n=gets.to_i
p n == 1 ? 0 : Prime.each(n).to_a.inject(:+)