#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for(T &x : v) is >> x;
    return is;
}
struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;
/*-------------------------------------------*/

int isp[1000009];

int main() {
    int l, r;
    cin >> l >> r;

    for(int i = 2; i < 1000009; i++)
        if(isp[i] == 0)
            for(int j = i; j < 1000009; j += i) isp[j] = i;

    ll ans = 0;
    FOR(i, 2, r + 1) {
        int g = i;
        int mn = l / g;
        if(l % g != 0) mn++;
        if(mn * g > r) continue;
        int mx = r / g;
        vector<int> ps;
        bool flag = true;
        while(g != 1) {
            if(!ps.empty() && ps.back() == isp[g]) flag = false;
            ps.push_back(isp[g]);
            g /= isp[g];
        }
        if(flag)
            ans += (ps.size() % 2 ? 1LL : -1LL) * (mx - mn + 1) * (mx - mn + 1);
        if(mn == 1) ans -= 2 * mx - 1;
        // cout << g << " " << ans << " " << mn << " " << mx << endl;
    }

    cout << ans << endl;
}
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long 
#define ull unsigned ll
#define ld long double 
#define mod 1000000007
#define pb push_back 
#define pf push_front
#define dll deque<ll> 
#define vll vector<ll>
#define vvll vector<vll> 
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define dpll deque<pll>
#define mapll map<ll,ll>
#define umapll unordered_map<ll,ll,custom_hash>
#define nl "\n" 
#define all(v) v.begin(),v.end() 
#define fr for(ll i=0;i<n;i++)
#define frr for(ll i=1;i<=n;i++)
#define ms(a,x) memset(a,x,sizeof(a))
//#define fr(aa,bb) for(ll i=aa;i<=bb;i++)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace __gnu_pbds;
vector<pair<ll,ll>>v[100005];
vector<string> split(const string& s, char c) {
    vector<string> v; stringstream ss(s); string x;
    while (getline(ss, x, c)) v.push_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
    stringstream s; s << "[";
    for(int i = 0; i < n - 1; i++) s << arr[i] << ",";
    s << arr[n - 1] << "]";
    return s.str();
}
#define EVARS(args...) {__evars_begin(__LINE__); __evars(split(#args, ',').begin(), args);}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template<typename T> inline void __evars_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
template<typename T> inline void __evars_out_var(T* val) { cerr << arrStr(val, 10); }
template<typename T> inline void __evars_out_var(T val) { cerr << val; }
inline void __evars(vector<string>::iterator it) { cerr << endl; }
template<typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
    cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
    __evars_out_var(a);
    cerr << "; ";
    __evars(++it, args...);
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
//template<class T, class H>using umap=unordered_map<T,H,custom_hash>;
//template<class T>using uset=unordered_set<T,custom_hash>;
ll dmod(ll x){
    return ((x+mod)%mod);
}
ll modular_power(ll x,ll y){
    ll ans=1;
    while(y){
        if(y&1)ans=dmod(ans*x);
        y/=2;
        x=dmod(x*x);
    }
    return ans;
}
ll inv(ll x){
    return modular_power(dmod(x),mod-2);
}

int main()
{
    //clock_t clk = clock();
    fio
    //cerr << '\n'<<"Time (in s): " << double(clock() - clk) * 1.0 / CLOCKS_PER_SEC << '\n';
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n,var;cin>>n;string s;
        vector<ll>v;
        unordered_map<ll,string,custom_hash>mp;
        fr
        {
            cin>>s>>var;
            mp[var]=s;
            v.pb(var);
        }
        sort(v.begin(),v.end());
        cout<<mp[v[v.size()-2]];
    }
    return 0;
}