# -*- 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 ans = math.fmod(ans,10**9+7) print int(ans)