# 백준 #31615 分 (Minutes) # H 입력 (정수형) H = int(input()) # M 입력 (정수형) M = int(input()) # 분 출력 print((H * 60) + M)