#include <bits/stdc++.h>

using namespace std;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define int ll

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

const int inf = 2e9, INF = 1e18;

struct Line {
    int k, b;

    Line(int _k = 0, int _b = -INF) {
        k = _k;
        b = _b;
    }

    int operator()(int x) {
        return k * x + b;
    }
};

void solve() {
    int n;
    cin >> n;
    vector<Line> a(n);
    int ans = 0;
    int now = 0;
    for (auto &[k, b]: a) {
        cin >> b >> k;
    }
    for (int i = 0; i < n; i++) {
        now += a[i](i + 1);
        ans = max(ans, now);
    }
    cout << ans;
}

int32_t main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int tt = 1;
    // cin >> tt;
    while (tt--) {
        solve();
    }
}
