# -*- coding:utf-8 -*- import math if __name__ == '__main__': n = int(input()) cnt = 0 for i in range(n): c, d = map(int, input().split()) cnt += math.ceil(c / 2) * d cnt %= 1000000007 print(cnt)