#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(a) a.begin(), a.end()
#define revall(a) a.rbegin(), a.rend();

#pragma GCC optimize("03")

const int mod = 998244353;

int fastpow(int base, int power, int modx) {
    if (power == 0) {
        return 1;
    }
    if (power % 2 == 0) {
        int x = fastpow(base, power / 2, modx) % modx;
        return (x * x) % modx;
    } else {
        return (base * fastpow(base, power - 1, modx)) % modx;
    }
}

void dfs(int i, vector<int> &vc) {

}

void solve() {
    int n; cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    vector<int> t(n, 0);
    int x = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        x += a[i] * t[i];
        ans = max(ans, x);
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int tt = 1;
    // cin >> tt;
    while (tt--) {
        solve();
    }
}