x, y = map(int, input().split()) print(12+x%4*3-x-y)