#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

const int mod = 1e9 + 7;
const int maxn = 2e5 + 1;

void solve() {
    int n; cin >> n;

    vector<ll> a(n), b(n);
    for (int i{}; i < n; i++) {
        cin >> a[i] >> b[i];
    }

    ll ans = max(0ll, a[0]);
    ll pref = a[0];
    for (int i = 1; i < n; i++) {
        pref += a[i] + b[i] * i;
        ans = max(ans, pref);
    }

    cout << ans;
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int it = 1;

    //cin >> it;

    while (it--) {
        solve();
    }
}