N = input() print sum(((c&1)+c/2)*d for c,d in [map(int,raw_input().split()) for i in range(N)])%(10**9+7)