while True: try: a,b=map(int,input().split()) c=(a+b)%7 if c==0: print(7) else: print(c) except: break