#146 test import math N=int(input()) C=[[float(i) for i in input(). split ()] for i in range(N)] S=0 M=10*10 for i in range(7): M*=10 M+=7 for i in range(N): if C[i][0]/2!=math.floor(C[i][0]/2): C[i][0]+=1 e=C[i][0]/2 e=e*C[i][1] e=e-math.floor(e/M) S+=e S=int(S) S%=M print (S)