def input() gets.chomp end def ii() input().to_i end def li() input().split.map(&:to_i) end m,d=li() puts (23+(m>8||m==8&&d>=22 ? 1 : 0))