#include <bits/stdc++.h>
using namespace std;
int _ = (cout << fixed << setprecision(9), cin.tie(0), ios::sync_with_stdio(0));
using Int = long long;
vector<int> divisor(int n) {
    vector<int> ans;
    for (int t = 1; t * t <= n; t++) {
        if (n % t != 0) continue;
        if (t * t == n) {
            ans.push_back(t);
        } else {
            ans.push_back(t);
            ans.push_back(n / t);
        }
    }
    return ans;
}
int main() {
    Int L, R; cin >> L >> R;
    vector<Int> A(500001);
    Int ans = 0;
    for (int n = 500000; n >= 2; n--) {
        Int t = (R / n) - ((L + n - 1) / n) + 1;
        A[n] += t * (t - 1) / 2;
        for (int d : divisor(n)) {
            if (d == 1 || d == n) continue;
            A[d] -= A[n];
        }
        Int a = A[n];
        if (L <= n && n <= R) {
            a -= t - 1;
        }
        ans += a;
    }
    cout << ans * 2 << '\n';
    return 0;
}

#include<bits/stdc++.h>
#define            pb            push_back
#define            pl            pair<ll,ll>
#define            pll           pair<ll,pair<ll,ll>>
#define            ll            long long
#define            vl            vector<ll>
#define            fastio        ios_base::sync_with_stdio(false); cin.tie(NULL);
#define            mp            make_pair
#define            w(t)          int t;cin>>t;while(t--)
#define            inf           1e18
#define            fi(a,n)       for(ll i=a;i<n;i++)
#define            fr(i,a,b)     for(ll i=a;i>=b;i--)
#define            fj(a,n)       for(ll j=a;j<n;j++)
#define            k(a,n)        for(ll k=a;k<n;k++)
#define            endl          "\n"
#define            all(v)        (v).begin(),(v).end()
#define            set1(x)       __builtin_popcount(x)
#define            gcd(a,b)      __gcd(a,b)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
using namespace std;
const ll mod= 1000000007;
const ll N =1000005;
ll v[N];
vl m(N,1);
ll f[N];
void seive()
{
  m[1]=1;
  fi(2,N)
  {
    if(!v[i])
    {
      for(ll j=i;j<N;j+=i)
      {

        if(j%(i*i)==0)m[j]=0;
        m[j]=-m[j];
        v[j]=1;
      }
    }
  }
}
void solve()
{
  ll l,r;
  cin>>l>>r;
  fi(l,r+1)
  {
    f[i]++;
  }
  ll ans=0;
  // fi(1,10)cout<<m[i]<<endl;
  fi(1,r+1)
  {
    if(m[i]==0)continue;
    ll temp=0;
    for(ll j=i;j<r+1;j+=i)
    {
       temp+=(f[j]);
    }
    // cout<<i<<" "<<temp<<endl;
    ans+=(temp*(temp-1)/2*m[i]);
  }
  ll x=r-l+1;
  ans=((x*(x-1))/2)-ans;
  // cout<<ans<<endl;
  ll kk=0;
  fi(max(2LL,l),r+1)
  {
    for(ll j=i;j<r+1;j+=i)
    {
       if(i==j)continue;
       else kk++;
    }
  }

  cout<<2*(ans-kk)<<endl;
}
int main()
{
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
      // w(t)
       seive();
      solve();

}