M,D=map(int,input().split()) print(24-(M<8 or(M==8 and D<22)))