require 'prime' n=gets.to_i dp=[0]*(n+2) x=Prime.each(n).to_a t=n/2+2 sum=0 while x[0]*2<=n e=x.shift sum+=e sum=[n,sum].min (sum-e+1).times{|i| p2=(sum-e+1)-i p3=e+p2 next if p3>n if dp[p2]>0 && dp[p3]