def Main(): x,y=map(int,input().split()) if x in [0,4,8]: print(12-x-y) if x in [1,5,9]: print(15-x-y) if x in [2,6,10]: print(18-x-y) if x in [3,7,11]: print(21-x-y) Main()