#include <bits/stdc++.h>
#pragma optimize "O3"
#pragma optimize "fast-math"
using namespace std;
#define int long long
using ll = long long;
using vint = vector<int>;
using pii = pair<int, int>;
const int INF = 1 << 30;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    int ans = INF, now = 0;
    vector<pii> v;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        now += a;
        if (b > 0) {
            now += b * i;
        }
        ans = max(ans, now);
        v.emplace_back(a, b);
    }
    cout << ans;
}

//
//5 10
//3 1 1 2 2
