#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<cstdio>
 
#define rep(i,n) for(int i=0; i<(n); ++i)
#define pai 3.1415926535897932384
#define NUM_MAX 2e18
#define NUM_MIN -1e9
 
using namespace std;
using ll =long long;
using P = pair<int,int>;
 
int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    
    int a, b;
    ll ans=0;
    rep(i, n){
        cin >> a >> b;
        
        for(int j=a; j<=b; j++){
            ans += j;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}
#include <iostream>
#include <cstdio>
#include <vector>
#define N 55
using namespace std;

typedef long long ll;
ll n, ans = 1e18, a[N];
bool vpr[N];
vector<ll> pr;

ll gcd(ll p, ll q) {
	if (q == 0) return p;
	return gcd(q, p % q);
}

void f(ll p, ll q) {
	ll i;
	if (q >= ans) return;
	if (p == pr.size()) {
		for (i = 0; i < n; i++) {
			if (gcd(q, a[i]) == 1) return;
		}
		ans = q;
		return;
	}
	f(p + 1, q);
	f(p + 1, q * pr[p]);
}

int main()
{
	ll i, j;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
	}
	for (i = 2; i <= 50; i++) {
		if (vpr[i]) continue;
		pr.push_back(i);
		for (j = i * 2; j <= 50; j += i) {
			vpr[j] = 1;
		}
	}
	f(0, 1);
    cout << ans << endl;
    return 0;
}