M, D= map(int, input().split()) def calc(M, D): if M == 8 and D >= 22 or M > 8: result= 24 else: result= 23 print(result) calc(M, D)