#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define SIZE 1005 #define INF 100000000 #define ll long long #define FD(d) fixed << setprecision(d) #define MOD 1000000007 using namespace std; #define ll long long typedef pair Pa; int main() { ll n; cin >> n; ll res = 0; for (ll i = 0; i < n; i++) { ll c, d; cin >> c >> d; res += ((c + 1) / 2) * d; } cout << res << endl; return (0); }