#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/modint>
// #include <atcoder/dsu>
// using namespace atcoder;
using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back

// using mint = modint998244353;
// using mint = modint1000000007;

int main() {
  int N; cin>>N;
  ll sum=0;
  rep(i,N) {
    ll a,b; cin>>a>>b;
    sum+=(b-a+1)*(a+b)/2;
  }
  cout<<sum<<endl;
}

#include <iostream>
#include <algorithm>

int n, x;
int v[1005];

int main()
{
	std::cin >> n >> x;
	x *= 100;
	for(int i = 1; i <= n; i++)
	{
		int p;
		std::cin >> v[i] >> p;
		v[i] *= p;
	}
	for(int i = 1; i <= n; i++)
	{
		x -= v[i];
		if(x < 0)
		{
			std::cout << i;
			return 0;
		}
	}
	std::cout << -1;
}