# -*- coding:utf-8 -*- import math if __name__ == "__main__": n = input() ans = 0 for i in xrange(n): c,d = map(int,raw_input().split()) ans += math.ceil(c / 2.0) * d print int(ans) % (10**9) + 7