# -*- 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 += (c+1) / 2 * d print ans % 1000000007