#include <iostream> #include <cstdio> #include <string> #include <cstring> #include <algorithm> using namespace std; int a[100010]; int p[100010]; int main() { int n; cin >> n; memset(a, 0, sizeof(a)); for (int i = 0; i<n; i++) cin >> a[i]>> p[i]; int res = 0, min = p[0]; for (int i = 0; i<n; i++) { if (p[i] < min) min = p[i]; res += min*a[i]; } cout << res<< endl; return 0; }