#pragma GCC optimize("O3, unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int long long
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

const int inf = 1e9L;
const int mod = 998244353;
const int maxn = 1e6 + 1;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    ll sm = 0, ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        sm += a[i] + b[i] * i;
        ans = max(ans, sm);
    }
    for (int i = 0; i < n; i++) {
        int p; cin >> p;
    }
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
        cout << '\n';
    }
}