j=gets.to_i p (0..j).flat_map {|t| (0..t).flat_map {|g| (0..j).map{|p| [t*5, g*2, p*3].sum }}}.count(j)