#include<iostream>
using namespace std;
int main() {
int N;
cin >> N;
int* a, * b;
a = new int[N];
b = new int[N];
for (int i = 0; i < N; i++) {
cin >> a[i] >> b[i];
}
int sum = 0;
for (int i = 0; i < N; i++) {
sum += a[i] * b[i];
}
if (sum < 0) {
cout << 0 << endl;
}
else {
cout << sum << endl;
}
return 0;
}