n,p,k = map(int,input().split()) for _ in range(n): t,b = map(int,input().split()) if t == 1: p += b else: p *= 2 if p > 10 ** 18:p = -1 print(p)