开灯 - 洛谷
""" P1161 开灯(python3实现) https://www.luogu.com.cn/problem/P1161 """ a=[0]*2000001 n=int(input()) for i in range(1,n+1): x,y=map( float,input().split() ) for j in range(1,int(y+1) ): if a[int(j*x)]==0: a[int(j*x)]=1 else: a[int(j*x)]=0 i=1 while 1: if a[i]==1: print(i) break i+=1