#include int main(void){ int N; // 机の種類 int C,D; // C:椅子の個数、D:同じ種類の机の個数 long int capacity = 0; scanf("%d",&N); for(int i = 0; i < N; i++){ scanf("%d %d",&C,&D); if(C % 2 != 0){ C /= 2; C++; }else{ C /= 2; } capacity += (C*D)%1000000007; capacity %= 1000000007; } printf("%ld\n",capacity); return 0; }