X = gets.chomp.to_i Y = gets.chomp.to_i Z = 0 if X % 4 == 0 Z = 12 - (X + Y) elsif X % 4 == 1 Z = 15 - (X + Y) elsif X % 4 == 2 Z = 18 - (X + Y) elsif X % 4 == 3 Z = 21 - (X + Y) end puts Z