#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <random>

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

const int INF = 1000000001;
const ll MOD = 998244353;
const ll INF2 = 1e18;

mt19937 rnd(0);

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

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

struct student {
	int a;
	int b;
	int operator()(int x) {
		return a + b * x;
	}
};

struct DP {
	ll ans;
	int l, r;
};

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

void precalc() {
	return;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll t_ = 1;
	//cin >> t_;
	precalc();
	ll i = 0;
	while (i < t_) {
		solve();
		i++;
	}
	return 0;
}