#include <bits/stdc++.h>   using namespace std;   int GCD(int x, int y) { return !y ? x : GCD(y, x % y); }   int LCM(int x, int y) { return x * y / GCD(x, y); }   long long ceilDivision(long long dividend, long long divisor) {     return (dividend + divisor - 1) / divisor;   }   bool check(pair<long long, int> right, pair<long long, int> left) {     return ((left.second > right.second) ||             (left.second == right.second && left.first > right.first));   }   int main() {     long long r, avg, sum = 0, target, counter = 0;     int n, pointer = 0;     cin >> n >> r >> avg;     vector<pair<long long, int> > arr(n);     target = avg * n;     for (int i = 0; i < n; i++)       cin >> arr[i].first >> arr[i].second, sum += arr[i].first;     if (sum < target) {       sort(arr.begin(), arr.end(), check);       target -= sum;       while (target) {         if (arr[pointer].first < r)           counter += (min(target, r - arr[pointer].first) * arr[pointer].second),               target -= min(target, r - arr[pointer].first);         pointer++;       }     }     cout << counter << endl;     return 0;   }   