h,m = map(int,input().split()) t = 60*h+m; s = 450; g = 510 if t