B=list(map(int,input().split())) for i in range(0,7): if B[i+1]-B[i] == 2: print(int((B[i+1]+B[i])/2)) elif B[0] != 1: print(1) break elif B[8] != 10: print(10) break