M, D = map(int, input().split()) if M == 8: if D < 22: print(23) else: print(24) elif M < 8: print(23) else: print(24)