#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

using namespace std;
using ll = long long;

template<typename T>
using ordered_set = tree<T, null_type, less<T>,
    rb_tree_tag, tree_order_statistics_node_update>;

template<typename T, typename Y>
istream &operator>>(istream &in, pair<T, Y> &a) {
    return in >> a.first >> a.second;
}

template<typename T, typename Y>
ostream &operator<<(ostream &out, const pair<T, Y> &a) {
    return out << a.first << ' ' << a.second;
}

template<typename T>
istream &operator>>(istream &in, vector<T> &a) {
    for (auto &i : a) {
        in >> i;
    }
    return in;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &a) {
    for (const auto &i : a) {
        out << i << ' ';
    }
    return out;
}

template<typename T>
void print(const vector<T> &a, string c = "\n") {
    for (const auto &i : a) {
        cout << i << c;
    }
}

void solve() {
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }
    // ll mx = -LLONG_MAX, now = 0;
    // for (int i = 0; i < n; ++i) {
    //     now += a[i].first;
    //     mx = max(mx, now);
    // }
    ll sum = 0, mx = 0;
    for (int i = 0; i < n; ++i) {
        sum += a[i] + b[i] * i;
        mx = max(mx, sum);
    }
    cout << mx;
}

int main() {
#ifdef LOCAL
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("err.txt", "w", stderr);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int times = 1;
    // cin >> times;
    while (times--) {
        solve();
        cout << '\n';
    }
}
