x,y = map(int,input().split()) for i in range(12): if i == x or i == y: continue if abs(i-x) == 4 or abs(i-y) == 4: print(i) exit()