#include using namespace std; int main(){ int n; cin >> n; int total = 0; int c,d; for(int i = 0; i < n; i++){ cin >> c >> d; c--; total += c * d; } cout << total << endl; return 0; }