X,Y=map(int,input().split()) tr=map(set,[ {0,4,8}, {1,5,9}, {2,6,10}, {3,7,11} ]) for t in tr: if X in t: t.remove(X) t.remove(Y) print(list(t)[0]) exit()