import sys input=sys.stdin.readline import itertools X, Y = map(int, input().split()) l = [X,Y] l.sort() X_prime, Y_prime = l[0], l[1] digit = [0,1,2,3,4,5,6,7,8,9,10,11] digit_list = digit*2 keys = [0,1,2,3,4,5,6,7,8,9,10,11]*2 d = dict(zip(keys,digit_list)) print(d.get(keys[Y_prime+4]))