M,D = map(int,input().split()) ans = 23 if M > 8: ans += 1 elif M == 8 and D >= 22: ans += 1 print(ans)