M, D = map(int, input().split()) print(M % 12 + 1 + D)