X, Y = map(int, input().split()) clock = [i for i in range(0, 12)] if clock[X - 4] == clock[Y]: print(clock[Y - 4]) else: print(clock[X - 4])