A,B = map(int,input().split()) A *= 30 A += (B/2) B *= 6 C = A-B C = C%360 D = C//5.5 E = (C-5.5*D)//(5.5/60) print(D,E)