a,b = map(int,input().split()) if a > b : n = a else: n = b p = n + 4 cnt = 1 while (p == a) or (p == b) or (cnt == 1): p = p + 4 if p >= 12: p -= 12 cnt = 0 print(p)