strs = "285714".split("") n = gets.chomp.to_i n = n % 6 if n > 6 n -= 1 puts strs[n]