#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <ctime>
#include <stack>
#include <deque>
#include <queue>
#include <climits>
#include <cmath>
#include <bitset>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define mid (l + r) / 2
//#define int long long

constexpr int maxn = 1'000'001;
int a[maxn];
int b[maxn];

void solve() {
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] + i * b[i] > 0) {
            ans += a[i] + i * b[i];
        }
    }
    cout << ans << '\n';
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}
