QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#703730#1395. Trzy drogi [A]TheZone10 ✓847ms147664kbC++2013.6kb2024-11-02 18:21:122024-11-02 18:21:14

Judging History

你现在查看的是最新测评结果

  • [2024-11-02 18:21:14]
  • 评测
  • 测评结果:10
  • 用时:847ms
  • 内存:147664kb
  • [2024-11-02 18:21:12]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<random>
#include<unordered_map>
#include<queue>
#define fi first
#define se second
using namespace std;
const int N=300010,M=500010;
typedef long long ll;
typedef unsigned long long ull;
typedef unordered_map<ull,ll> umap;
typedef priority_queue<pair<int,int>> pq;
mt19937_64 Rnd(1234);
struct node{
    int x,y,c;
}r[M];
int f[N],n,m,ms;ll ans;
ull h[M];
bool cut[M];
ll C2(int x){return 1ll*x*(x-1)/2;}
int find(int x){return x==f[x]?f[x]:(f[x]=find(f[x]));}
void reset()
{
    int m0=m,n0=n;n=m=ms=0;static int id[N];
    for(int i=1;i<=n0;i++) f[i]=i,id[i]=0;
    for(int i=1;i<=m0;i++) if(cut[i]) f[find(r[i].x)]=find(r[i].y);
    for(int i=1;i<=n0;i++) if(i==f[i] && !id[i]) id[i]=++n;
    for(int i=1;i<=m0;i++)
    {
        r[i].x=id[find(r[i].x)],r[i].y=id[find(r[i].y)];
        if(r[i].x!=r[i].y) r[++m]=r[i],ms+=r[i].c;
    }
    for(int i=1;i<=m0;i++) cut[i]=false;
}
vector<pair<int,int>>g[N];bool on[M];int dep[N],pre[N],dfn[N];
namespace rand_road{
    bool vis[N];
    ull d[N];int idx;
    void dfs(int u)
    {
        vis[u]=true;dfn[u]=++idx;
        for(auto [v,id]:g[u]) if(!vis[v]) pre[v]=id,dep[v]=dep[u]+1,dfs(v),on[id]=true;
    }
    void dfs2(int u){for(auto [v,id]:g[u]) dfs2(v),h[id]=d[v],d[u]^=d[v];}
    void init()
    {
        for(int i=1;i<=n;i++) d[i]=dfn[i]=dep[i]=0,vis[i]=false,g[i].clear();
        for(int i=1;i<=m;i++) on[i]=false,h[i]=0;
        idx=0;
        for(int i=1;i<=m;i++) g[r[i].x].push_back({r[i].y,i}),g[r[i].y].push_back({r[i].x,i});
        dfs(1);
        for(int i=1;i<=n;i++) g[i].clear();
        for(int i=1;i<=m;i++)
            if(on[i])
            {
                if(dep[r[i].x]<dep[r[i].y]) g[r[i].x].push_back({r[i].y,i});
                else g[r[i].y].push_back({r[i].x,i});
            }
            else h[i]=Rnd(),d[r[i].x]^=h[i],d[r[i].y]^=h[i];
        dfs2(1);
    }
}
void solve0()
{
    rand_road::init();
    umap mp;
    for(int i=1;i<=m;i++) if(h[i]==0) --ms,ans+=C2(ms),cut[i]=true;
    else mp[h[i]]++;
    for(int i=1;i<=m;i++) if(!mp.count(h[i])) cut[i]=true;
    else ans+=C2(r[i].c=mp[h[i]])*(ms-r[i].c)+1ll*r[i].c*(r[i].c-1)*(r[i].c-2)/6,mp.erase(h[i]);
    reset();
}
int s0[N],s1[N];ll s2[N];
void add_l(int l,int r,int w)
{
    if(dep[l]>dep[r]) swap(l,r);
    s0[r]++,s0[l]--,s1[r]+=w,s1[l]-=w,s2[r]+=1ll*w*w,s2[l]-=1ll*w*w;
}
void dfs1(int u)
{
    for(auto [v,id]:g[u]) dfs1(v),s0[u]+=s0[v],s1[u]+=s1[v],s2[u]+=s2[v];
    if(s0[u]==2) ans+=r[pre[u]].c*((1ll*s1[u]*s1[u]-s2[u])/2);
}
int up[N],dn[N];
void clear(pq &x){while(!x.empty()) x.pop();}
pq rt[N],rt2[N];umap mp[N],mp0;
void merge(umap &x,umap &y)
{
    if(x.size()<y.size()) x.swap(y);
    for(auto v:y) x[v.fi]+=v.se;
    y.clear();
}
void merge(pq &x,pq &y)
{
    if(x.size()<y.size()) x.swap(y);
    while(!y.empty()) x.push(y.top()),y.pop();
}
void pop(pq &x,int d){while(!x.empty() && dep[r[x.top().se].y]>=d) x.pop();}
void dfs2(int u)
{
    for(auto [v,id]:g[u]) dfs2(v),merge(rt[u],rt[v]);
    pop(rt[u],dep[u]);
    if(!rt[u].empty()) up[u]=rt[u].top().se;
}
void check(umap &a,int x,int y){if(x && y && a.count(h[x]^h[y])) ans+=r[x].c*r[y].c*a[h[x]^h[y]];}
void dfs3(int u)
{
    check(mp0,pre[u],up[u]);
    if(pre[u]) mp0[h[pre[u]]]+=r[pre[u]].c;
    for(auto [v,id]:g[u]) dfs3(v);
    if(pre[u]) mp0[h[pre[u]]]-=r[pre[u]].c;
}
void dfs4(int u)
{
    for(auto [v,id]:g[u]) dfs4(v),merge(rt[u],rt[v]),merge(rt2[u],rt2[v]),merge(mp[u],mp[v]);
    pop(rt[u],dep[u]),pop(rt2[u],dep[u]);
    if(pre[u])
    {
        if(!rt[u].empty()) check(mp[u],pre[u],rt[u].top().se);
        if(!rt2[u].empty()) check(mp[u],pre[u],rt2[u].top().se);
        mp[u][h[pre[u]]]+=r[pre[u]].c;
    }
}
void solve()
{
    while(n>1)
    {
        rand_road::init();
        for(int i=1;i<=n;i++) s0[i]=s1[i]=s2[i]=0;
        for(int i=1;i<=m;i++) if(dep[r[i].x]<dep[r[i].y]) swap(r[i].x,r[i].y);
        for(int i=1;i<=m;i++) if(!on[i]) add_l(r[i].x,r[i].y,r[i].c);
        dfs1(1);
        for(int i=1;i<=n;i++) clear(rt[i]);mp0.clear();
        for(int i=1;i<=m;i++) if(!on[i]) rt[r[i].x].push({dep[r[i].y],i});
        dfs2(1),dfs3(1);
        for(int i=1;i<=n;i++) clear(rt[i]),clear(rt2[i]),mp[i].clear();
        for(int i=1;i<=m;i++) if(!on[i]) rt[r[i].x].push({dfn[r[i].x],i}),rt2[r[i].x].push({-dfn[r[i].x],i});
        dfs4(1);
        for(int i=1;i<=m;i++) if(!on[i]) cut[i]=true;
        reset();
    }
}
int main()
{
    scanf("%d%d",&n,&m),ms=m;
    for(int i=1;i<=n;i++) f[i]=i;
    for(int i=1;i<=m;i++) scanf("%d%d",&r[i].x,&r[i].y),r[i].c=1;
    solve0();
    // cerr<<n<<" "<<m<<endl;
    // for(int i=1;i<=m;i++) printf("%d %d\n",r[i].x,r[i].y);
    solve();
    printf("%lld\n",ans);
    return 0;
}

/*#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<random>
#include<unordered_map>
#include<queue>
#define fi first
#define se second
using namespace std;
const int N=300010,M=500010;
typedef long long ll;
typedef unsigned long long ull;
typedef unordered_map<ull,ll> umap;
typedef priority_queue<pair<int,int>> pq;
mt19937_64 Rnd(1234);
struct node{
    int x,y,c;
}r[M];
int f[N],n,m,ms;ll ans;
ull h[M];
bool cut[M];
ll C2(int x){return 1ll*x*(x-1)/2;}
int find(int x){return x==f[x]?f[x]:(f[x]=find(f[x]));}
void reset()
{
    int m0=m,n0=n;n=m=ms=0;static int id[N];
    for(int i=1;i<=n0;i++) f[i]=i,id[i]=0;
    for(int i=1;i<=m0;i++) if(cut[i]) f[find(r[i].x)]=find(r[i].y);
        for(int i=1;i<=m;i++) g[r[i].x].push_back({r[i].y,i}),g[r[i].y].push_back({r[i].x,i});
        dfs(1);
        for(int i=1;i<=n;i++) g[i].clear();
        for(int i=1;i<=m;i++)
            if(on[i])
            {
                if(dep[r[i].x]<dep[r[i].y]) g[r[i].x].push_back({r[i].y,i});
                else g[r[i].y].push_back({r[i].x,i});
            }
            else h[i]=Rnd(),d[r[i].x]^=h[i],d[r[i].y]^=h[i];
        dfs2(1);
    }
}
void solve0()
{
    rand_road::init();
    umap mp;
    for(int i=1;i<=m;i++) if(h[i]==0) --ms,ans+=C2(ms),cut[i]=true;
    else mp[h[i]]++;
    for(int i=1;i<=m;i++) if(!mp.count(h[i])) cut[i]=true;
    else ans+=C2(r[i].c=mp[h[i]])*(ms-r[i].c)+1ll*r[i].c*(r[i].c-1)*(r[i].c-2)/6,mp.erase(h[i]);
    reset();
}
int s0[N],s1[N];ll s2[N];
void add_l(int l,int r,int w)
{
    if(dep[l]>dep[r]) swap(l,r);
    s0[r]++,s0[l]--,s1[r]+=w,s1[l]-=w,s2[r]+=1ll*w*w,s2[l]-=1ll*w*w;
}
void dfs1(int u)
{
    for(auto [v,id]:g[u]) dfs1(v),s0[u]+=s0[v],s1[u]+=s1[v],s2[u]+=s2[v];
    if(s0[u]==2) ans+=r[pre[u]].c*((1ll*s1[u]*s1[u]-s2[u])/2);
}
int up[N],dn[N];
void clear(pq &x){while(!x.empty()) x.pop();}
pq rt[N],rt2[N];umap mp[N],mp0;
void merge(umap &x,umap &y)
{
    if(x.size()<y.size()) x.swap(y);
    for(auto v:y) x[v.fi]+=v.se;
    y.clear();
}
void merge(pq &x,pq &y)
{
    if(x.size()<y.size()) x.swap(y);
    while(!y.empty()) x.push(y.top()),y.pop();
}
void pop(pq &x,int d){while(!x.empty() && dep[r[x.top().se].y]>=d) x.pop();}
void dfs2(int u)
{
    for(auto [v,id]:g[u]) dfs2(v),merge(rt[u],rt[v]);
    pop(rt[u],dep[u]);
    if(!rt[u].empty()) up[u]=rt[u].top().se;
}
void check(umap &a,int x,int y){if(x && y && a.count(h[x]^h[y])) ans+=r[x].c*r[y].c*a[h[x]^h[y]];}
void dfs3(int u)
{
    check(mp0,pre[u],up[u]);
    if(pre[u]) mp0[h[pre[u]]]+=r[pre[u]].c;
    for(auto [v,id]:g[u]) dfs3(v);
    if(pre[u]) mp0[h[pre[u]]]-=r[pre[u]].c;
}
void dfs4(int u)
{
    for(auto [v,id]:g[u]) dfs4(v),merge(rt[u],rt[v]),merge(rt2[u],rt2[v]),merge(mp[u],mp[v]);
    pop(rt[u],dep[u]),pop(rt2[u],dep[u]);
    if(pre[u])
    {
        if(!rt[u].empty()) check(mp[u],pre[u],rt[u].top().se);
        if(!rt2[u].empty()) check(mp[u],pre[u],rt2[u].top().se);
        mp[u][h[pre[u]]]+=r[pre[u]].c;
    }
}
void solve()
{
    while(n>1)
    {
        rand_road::init();
        for(int i=1;i<=n;i++) s0[i]=s1[i]=s2[i]=0;
        for(int i=1;i<=m;i++) if(dep[r[i].x]<dep[r[i].y]) swap(r[i].x,r[i].y);
        for(int i=1;i<=m;i++) if(!on[i]) add_l(r[i].x,r[i].y,r[i].c);
        dfs1(1);
        for(int i=1;i<=n;i++) clear(rt[i]);mp0.clear();
        for(int i=1;i<=m;i++) if(!on[i]) rt[r[i].x].push({dep[r[i].y],i});
        dfs2(1),dfs3(1);
        for(int i=1;i<=n;i++) clear(rt[i]),clear(rt2[i]),mp[i].clear();
        for(int i=1;i<=m;i++) if(!on[i]) rt[r[i].x].push({dfn[r[i].x],i}),rt2[r[i].x].push({-dfn[r[i].x],i});
        dfs4(1);
        for(int i=1;i<=m;i++) if(!on[i]) cut[i]=true;
        reset();
    }
}
int main()
{
    scanf("%d%d",&n,&m),ms=m;
    for(int i=1;i<=n;i++) f[i]=i;
    for(int i=1;i<=m;i++) scanf("%d%d",&r[i].x,&r[i].y),r[i].c=1;
    solve0();
    // cerr<<n<<" "<<m<<endl;
    // for(int i=1;i<=m;i++) printf("%d %d\n",r[i].x,r[i].y);
    solve();
    printf("%lld\n",ans);
    return 0;
}
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<random>
#include<unordered_map>
#include<queue>
#define fi first
#define se second
using namespace std;
const int N=300010,M=500010;
typedef long long ll;
typedef unsigned long long ull;
typedef unordered_map<ull,ll> umap;
typedef priority_queue<pair<int,int>> pq;
mt19937_64 Rnd(1234);
struct node{
    int x,y,c;
}r[M];
int f[N],n,m,ms;ll ans;
ull h[M];
bool cut[M];
ll C2(int x){return 1ll*x*(x-1)/2;}
int find(int x){return x==f[x]?f[x]:(f[x]=find(f[x]));}
void reset()
{
    int m0=m,n0=n;n=m=ms=0;static int id[N];
    for(int i=1;i<=n0;i++) f[i]=i,id[i]=0;
    for(int i=1;i<=m0;i++) if(cut[i]) f[find(r[i].x)]=find(r[i].y);
    for(int i=1;i<=n0;i++) if(i==f[i] && !id[i]) id[i]=++n;
    for(int i=1;i<=m0;i++)
    {
        r[i].x=id[find(r[i].x)],r[i].y=id[find(r[i].y)];
        if(r[i].x!=r[i].y) r[++m]=r[i],ms+=r[i].c;
    }
    for(int i=1;i<=m0;i++) cut[i]=false;
}
vector<pair<int,int>>g[N];bool on[M];int dep[N],pre[N],dfn[N];
namespace rand_road{
    bool vis[N];
    ull d[N];int idx;
    void dfs(int u)
    {
        vis[u]=true;dfn[u]=++idx;
        for(auto [v,id]:g[u]) if(!vis[v]) pre[v]=id,dep[v]=dep[u]+1,dfs(v),on[id]=true;
    }
    void dfs2(int u){for(auto [v,id]:g[u]) dfs2(v),h[id]=d[v],d[u]^=d[v];}
    void init()
    {
        for(int i=1;i<=n;i++) d[i]=dfn[i]=dep[i]=0,vis[i]=false,g[i].clear();
        for(int i=1;i<=m;i++) on[i]=false,h[i]=0;
        idx=0;
        for(int i=1;i<=m;i++) g[r[i].x].push_back({r[i].y,i}),g[r[i].y].push_back({r[i].x,i});
        dfs(1);
        for(int i=1;i<=n;i++) g[i].clear();
        for(int i=1;i<=m;i++)
            if(on[i])
            {
                if(dep[r[i].x]<dep[r[i].y]) g[r[i].x].push_back({r[i].y,i});
                else g[r[i].y].push_back({r[i].x,i});
            }
            else h[i]=Rnd(),d[r[i].x]^=h[i],d[r[i].y]^=h[i];
        dfs2(1);
    }
}
void solve0()
{
    rand_road::init();
    umap mp;
    for(int i=1;i<=m;i++) if(h[i]==0) --ms,ans+=C2(ms),cut[i]=true;
    else mp[h[i]]++;
    for(int i=1;i<=m;i++) if(!mp.count(h[i])) cut[i]=true;
    else ans+=C2(r[i].c=mp[h[i]])*(ms-r[i].c)+1ll*r[i].c*(r[i].c-1)*(r[i].c-2)/6,mp.erase(h[i]);
    reset();
}
int s0[N],s1[N];ll s2[N];
void add_l(int l,int r,int w)
{
    if(dep[l]>dep[r]) swap(l,r);
    s0[r]++,s0[l]--,s1[r]+=w,s1[l]-=w,s2[r]+=1ll*w*w,s2[l]-=1ll*w*w;
}
void dfs1(int u)
{
    for(auto [v,id]:g[u]) dfs1(v),s0[u]+=s0[v],s1[u]+=s1[v],s2[u]+=s2[v];
    if(s0[u]==2) ans+=r[pre[u]].c*((1ll*s1[u]*s1[u]-s2[u])/2);
}
int up[N],dn[N];
void clear(pq &x){while(!x.empty()) x.pop();}
pq rt[N],rt2[N];umap mp[N],mp0;
void merge(umap &x,umap &y)
{
    if(x.size()<y.size()) x.swap(y);
    for(auto v:y) x[v.fi]+=v.se;
    y.clear();
}
void merge(pq &x,pq &y)
{
    if(x.size()<y.size()) x.swap(y);
    while(!y.empty()) x.push(y.top()),y.pop();
}
void pop(pq &x,int d){while(!x.empty() && dep[r[x.top().se].y]>=d) x.pop();}
void dfs2(int u)
{
    for(auto [v,id]:g[u]) dfs2(v),merge(rt[u],rt[v]);
    pop(rt[u],dep[u]);
    if(!rt[u].empty()) up[u]=rt[u].top().se;
}
void check(umap &a,int x,int y){if(x && y && a.count(h[x]^h[y])) ans+=r[x].c*r[y].c*a[h[x]^h[y]];}
void dfs3(int u)
{
    check(mp0,pre[u],up[u]);
    if(pre[u]) mp0[h[pre[u]]]+=r[pre[u]].c;
    for(auto [v,id]:g[u]) dfs3(v);
    if(pre[u]) mp0[h[pre[u]]]-=r[pre[u]].c;
}
void dfs4(int u)
{
    for(auto [v,id]:g[u]) dfs4(v),merge(rt[u],rt[v]),merge(rt2[u],rt2[v]),merge(mp[u],mp[v]);
    pop(rt[u],dep[u]),pop(rt2[u],dep[u]);
    if(pre[u])
    {
        if(!rt[u].empty()) check(mp[u],pre[u],rt[u].top().se);
        if(!rt2[u].empty()) check(mp[u],pre[u],rt2[u].top().se);
        mp[u][h[pre[u]]]+=r[pre[u]].c;
    }
}
void solve()
{
    while(n>1)
    {
        rand_road::init();
        for(int i=1;i<=n;i++) s0[i]=s1[i]=s2[i]=0;
        for(int i=1;i<=m;i++) if(dep[r[i].x]<dep[r[i].y]) swap(r[i].x,r[i].y);
        for(int i=1;i<=m;i++) if(!on[i]) add_l(r[i].x,r[i].y,r[i].c);
        dfs1(1);
        for(int i=1;i<=n;i++) clear(rt[i]);mp0.clear();
        for(int i=1;i<=m;i++) if(!on[i]) rt[r[i].x].push({dep[r[i].y],i});
        dfs2(1),dfs3(1);
        for(int i=1;i<=n;i++) clear(rt[i]),clear(rt2[i]),mp[i].clear();
        for(int i=1;i<=m;i++) if(!on[i]) rt[r[i].x].push({dfn[r[i].x],i}),rt2[r[i].x].push({-dfn[r[i].x],i});
        dfs4(1);
        for(int i=1;i<=m;i++) if(!on[i]) cut[i]=true;
        reset();
    }
}
int main()
{
    scanf("%d%d",&n,&m),ms=m;
    for(int i=1;i<=n;i++) f[i]=i;
    for(int i=1;i<=m;i++) scanf("%d%d",&r[i].x,&r[i].y),r[i].c=1;
    solve0();
    // cerr<<n<<" "<<m<<endl;
    // for(int i=1;i<=m;i++) printf("%d %d\n",r[i].x,r[i].y);
    solve();
    printf("%lld\n",ans);
    return 0;
}
*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #2:

score: 1
Accepted
time: 5ms
memory: 57768kb

input:

2 3
1 2
1 2
2 1

output:

1

result:

ok single line: '1'

Test #3:

score: 1
Accepted
time: 10ms
memory: 56420kb

input:

2 4
2 1
2 1
1 2
1 2

output:

0

result:

ok single line: '0'

Test #4:

score: 1
Accepted
time: 0ms
memory: 56404kb

input:

5 11
4 5
5 1
2 1
4 1
4 2
1 3
2 4
3 2
1 4
4 1
3 4

output:

10

result:

ok single line: '10'

Test #5:

score: 1
Accepted
time: 3ms
memory: 57372kb

input:

10 20
10 9
6 9
1 5
1 3
7 6
7 5
3 7
6 2
1 2
6 1
6 5
1 2
8 1
9 2
9 6
1 4
4 3
8 5
1 10
4 5

output:

39

result:

ok single line: '39'

Test #6:

score: 1
Accepted
time: 3ms
memory: 56760kb

input:

20 44
14 9
8 1
2 18
18 4
19 3
17 11
17 11
14 9
16 14
3 15
10 11
1 15
19 16
10 8
1 20
20 10
19 11
2 10
11 14
19 4
12 15
16 19
11 13
8 15
17 7
15 20
7 12
19 16
8 10
18 19
4 16
11 12
17 18
18 20
13 17
10 6
4 6
1 12
19 10
9 16
15 5
11 9
15 19
12 14

output:

1108

result:

ok single line: '1108'

Test #7:

score: 1
Accepted
time: 0ms
memory: 60332kb

input:

40 117
14 22
40 21
34 10
35 34
24 32
1 20
37 35
30 21
1 16
3 22
20 15
34 3
10 21
26 2
31 18
19 3
27 11
19 11
5 34
34 21
14 4
19 2
24 9
10 8
7 8
7 15
29 35
20 7
26 34
6 15
34 38
33 18
29 26
4 22
31 6
29 8
13 11
22 12
3 1
28 40
9 3
26 29
13 24
6 30
25 18
33 32
28 21
17 2
31 17
2 22
39 13
8 11
9 1
39 1...

output:

118

result:

ok single line: '118'

Test #8:

score: 1
Accepted
time: 16ms
memory: 60028kb

input:

40 120
5 35
3 31
1 22
19 7
40 27
32 26
15 18
14 24
12 6
39 1
19 8
30 19
9 27
38 12
21 23
19 32
8 15
4 11
13 39
11 6
32 37
16 20
2 5
32 40
31 35
23 6
7 29
8 28
5 11
20 29
32 15
16 8
19 9
23 19
35 1
13 39
34 9
12 31
15 8
34 28
36 9
29 20
36 39
6 13
18 20
23 2
25 9
33 3
20 4
26 20
6 9
1 6
24 9
39 35
11...

output:

14044

result:

ok single line: '14044'

Test #9:

score: 1
Accepted
time: 7ms
memory: 61316kb

input:

40 116
19 14
31 27
14 40
18 36
8 17
24 13
19 15
32 9
24 10
5 39
22 11
5 29
25 28
34 30
38 8
14 32
1 13
31 14
32 26
6 40
40 13
37 19
27 9
4 13
28 22
10 36
40 18
26 22
21 1
35 23
1 21
38 3
36 15
9 5
21 40
23 24
21 10
16 7
4 26
23 36
21 18
20 14
23 39
28 29
22 5
37 23
21 36
7 37
40 14
3 39
6 38
17 23
1...

output:

120

result:

ok single line: '120'

Test #10:

score: 1
Accepted
time: 7ms
memory: 57900kb

input:

40 102
38 23
25 33
21 9
26 40
13 18
40 13
13 5
2 23
13 26
8 1
21 32
11 25
28 14
15 18
5 24
34 39
27 17
31 8
4 36
14 27
13 36
24 23
18 30
29 20
4 19
11 37
40 11
34 7
24 18
40 31
16 27
6 33
11 7
24 10
28 39
36 40
4 28
33 9
12 31
4 3
11 21
24 11
23 9
17 29
37 7
10 4
6 16
20 6
23 27
19 4
9 13
1 38
2 37
...

output:

5548

result:

ok single line: '5548'

Test #11:

score: 1
Accepted
time: 0ms
memory: 59076kb

input:

40 120
34 28
9 16
36 12
23 24
9 16
20 12
15 36
15 37
2 10
4 3
18 8
7 5
9 31
37 28
4 9
20 38
28 15
17 32
6 18
1 18
9 4
13 27
8 22
30 22
38 12
19 23
5 33
1 39
11 38
34 37
3 7
10 37
2 28
11 20
32 14
35 38
13 30
2 15
30 8
19 34
11 1
35 11
31 16
14 17
18 6
31 25
32 17
34 10
36 2
29 36
28 29
38 39
1 35
17...

output:

14044

result:

ok single line: '14044'

Test #12:

score: 1
Accepted
time: 10ms
memory: 58292kb

input:

40 120
11 35
15 23
5 34
32 23
29 22
35 40
38 10
18 36
11 21
8 30
31 4
39 40
18 13
1 13
19 1
13 6
28 16
29 22
19 24
4 17
33 26
38 16
38 10
6 9
7 35
23 37
27 30
31 5
14 3
32 2
4 17
20 38
38 21
35 7
24 19
21 7
17 4
8 30
3 28
3 12
34 31
21 10
19 24
32 39
12 27
11 40
31 5
32 17
10 38
31 17
4 34
25 24
14 ...

output:

125

result:

ok single line: '125'

Test #13:

score: 1
Accepted
time: 4ms
memory: 55668kb

input:

40 60
25 29
34 21
36 17
5 2
31 19
26 27
30 6
29 35
16 31
22 39
1 24
4 37
10 9
28 6
7 16
9 20
21 33
11 18
35 10
13 24
26 12
18 25
28 11
23 18
3 24
7 9
30 38
31 8
32 36
14 16
15 5
30 37
7 35
39 3
29 10
8 40
33 38
23 20
22 40
28 33
20 17
21 1
6 38
8 19
34 4
14 2
22 3
14 5
17 27
34 37
4 32
12 36
32 15
3...

output:

58

result:

ok single line: '58'

Test #14:

score: 1
Accepted
time: 7ms
memory: 55752kb

input:

40 60
38 18
33 13
27 17
35 8
2 11
16 9
26 13
23 40
9 1
22 14
17 18
29 2
32 3
23 37
28 32
30 7
11 38
6 24
32 14
39 22
26 31
20 3
40 5
7 15
35 39
4 35
34 10
37 12
17 36
4 10
27 20
39 38
11 10
21 27
2 16
36 20
29 6
30 33
21 18
28 36
12 7
14 3
25 8
29 25
26 9
19 23
34 1
24 1
24 31
37 31
40 12
30 15
34 1...

output:

58

result:

ok single line: '58'

Test #15:

score: 1
Accepted
time: 3ms
memory: 58200kb

input:

40 60
7 5
16 26
11 23
24 2
4 20
36 12
1 28
23 21
36 20
4 1
12 9
31 7
18 30
19 2
28 36
38 16
19 17
26 38
13 29
5 11
16 14
17 21
5 37
8 15
27 15
13 10
37 7
40 23
34 35
1 32
8 24
14 10
34 32
15 20
30 25
3 33
30 26
17 2
33 39
28 6
9 6
11 31
22 8
24 13
27 40
27 25
22 25
38 18
4 19
34 39
3 6
40 35
9 3
22 ...

output:

58

result:

ok single line: '58'

Test #16:

score: 1
Accepted
time: 3ms
memory: 57848kb

input:

39 57
28 7
22 5
4 16
2 19
7 35
29 39
18 3
31 32
30 31
27 20
34 13
23 37
32 26
5 39
38 3
13 5
21 11
16 14
38 33
2 25
28 8
24 26
20 9
15 27
36 22
8 10
1 35
17 9
3 33
26 31
17 16
15 23
14 12
25 13
4 30
21 6
6 1
19 23
34 15
17 14
29 22
33 34
25 19
21 35
28 11
39 18
32 12
27 37
12 4
7 11
36 6
18 29
1 38
...

output:

401

result:

ok single line: '401'

Test #17:

score: 1
Accepted
time: 3ms
memory: 58184kb

input:

39 57
8 25
33 31
35 20
2 6
4 24
14 28
15 37
25 16
23 36
12 32
32 9
31 39
27 31
11 9
24 1
22 30
5 29
6 21
19 8
39 3
14 29
4 20
36 30
20 18
28 25
4 37
14 23
12 7
35 13
2 30
18 10
2 17
9 3
35 24
5 16
18 38
28 5
7 3
29 10
17 33
26 21
6 15
1 36
11 34
37 21
33 26
1 15
23 13
19 38
13 38
39 34
8 16
22 7
26 ...

output:

279

result:

ok single line: '279'

Test #18:

score: 1
Accepted
time: 0ms
memory: 61180kb

input:

39 57
26 9
35 32
34 35
22 21
38 31
39 28
11 12
33 9
4 12
11 15
15 24
2 36
34 33
1 13
27 32
21 31
7 27
23 30
25 26
26 15
31 16
4 11
3 30
17 3
7 2
16 38
23 19
27 6
23 22
22 19
20 28
19 29
24 8
3 13
6 39
18 17
24 12
1 4
34 14
5 36
17 2
37 14
1 8
20 10
30 13
35 14
37 32
39 10
33 10
21 29
28 6
37 25
36 1...

output:

464

result:

ok single line: '464'

Test #19:

score: 1
Accepted
time: 3ms
memory: 55744kb

input:

40 60
22 28
5 3
37 33
18 34
25 5
17 32
20 21
38 40
7 35
8 28
18 29
24 17
36 31
32 13
28 11
36 12
17 27
13 9
18 20
23 15
10 6
34 8
36 14
7 16
4 33
23 39
27 24
11 23
3 25
39 11
21 30
30 20
16 9
1 38
30 14
15 26
12 14
1 40
22 26
16 39
8 22
10 24
33 31
4 31
37 6
13 35
3 19
2 15
5 21
2 26
6 38
34 29
27 2...

output:

58

result:

ok single line: '58'

Test #20:

score: 1
Accepted
time: 3ms
memory: 60076kb

input:

40 120
1 30
7 1
2 5
7 1
33 18
33 25
15 3
5 39
17 34
39 5
1 40
5 31
38 16
35 37
24 25
1 35
5 2
1 20
20 22
7 1
40 1
3 6
35 1
9 38
38 9
25 24
34 17
33 36
32 28
37 21
7 11
11 38
33 18
12 17
33 19
7 6
29 15
7 26
28 32
9 28
2 5
12 17
20 12
7 26
5 2
24 25
38 16
13 23
20 1
12 14
25 33
2 27
20 12
34 17
22 20...

output:

15327

result:

ok single line: '15327'

Test #21:

score: 1
Accepted
time: 4ms
memory: 56780kb

input:

40 120
7 3
22 19
38 10
29 33
11 34
23 38
39 5
25 39
21 11
15 35
15 35
23 27
16 28
12 7
26 36
40 36
2 1
16 38
30 12
27 23
16 28
38 16
39 25
35 5
11 21
19 22
19 32
3 7
5 39
32 11
36 38
35 15
28 16
7 35
36 26
13 19
35 5
32 11
19 22
31 12
40 36
29 36
27 23
12 31
32 11
7 3
10 38
24 8
23 27
11 29
16 38
15...

output:

53591

result:

ok single line: '53591'

Test #22:

score: 1
Accepted
time: 3ms
memory: 57588kb

input:

40 120
2 9
28 11
23 31
30 34
8 30
25 4
30 27
34 30
27 30
20 33
2 9
37 10
37 10
40 24
13 28
16 7
9 18
32 2
9 18
17 16
16 11
13 28
15 40
11 35
3 9
27 11
22 3
27 30
23 14
34 30
9 1
11 16
11 27
17 20
30 27
10 9
20 9
16 40
18 9
13 28
1 9
30 38
20 17
38 30
12 9
22 3
9 3
23 31
40 24
20 33
30 26
30 27
30 34...

output:

47710

result:

ok single line: '47710'

Test #23:

score: 1
Accepted
time: 4ms
memory: 58248kb

input:

40 59
36 34
2 18
33 36
4 30
28 18
3 14
3 36
38 24
31 23
31 11
21 17
10 6
8 9
40 35
32 7
14 23
1 3
16 12
37 22
14 37
28 19
25 7
24 25
35 29
6 4
19 16
15 6
17 34
10 32
10 30
32 20
12 5
15 27
23 22
9 20
16 24
7 9
39 21
2 40
30 20
11 26
26 15
40 21
4 26
29 5
38 19
12 28
13 22
39 33
27 13
2 29
27 11
34 3...

output:

173

result:

ok single line: '173'

Test #24:

score: 1
Accepted
time: 3ms
memory: 58884kb

input:

40 59
5 16
1 2
40 25
40 15
7 27
16 17
24 11
29 23
24 37
30 26
36 28
9 38
8 18
17 33
23 34
24 8
8 21
16 9
28 6
25 32
39 26
14 34
13 21
32 39
37 3
25 33
13 22
38 15
21 20
29 4
20 3
18 4
19 23
17 15
5 6
3 19
10 34
22 26
36 5
37 29
20 11
31 18
12 13
22 31
7 35
1 6
10 27
11 12
27 14
7 19
39 31
14 2
38 33...

output:

165

result:

ok single line: '165'

Test #25:

score: 1
Accepted
time: 4ms
memory: 56228kb

input:

38 59
24 1
21 16
34 8
29 33
23 15
24 5
29 22
10 13
6 10
33 8
9 36
5 6
11 12
35 2
7 18
10 31
20 25
36 28
28 23
33 21
24 10
22 12
11 17
14 4
32 21
29 16
19 7
9 15
1 32
27 20
3 19
26 30
19 15
1 16
38 13
18 27
22 37
35 19
31 25
6 24
37 16
26 38
34 12
27 38
13 31
4 9
3 18
24 37
25 10
3 20
14 36
4 15
29 3...

output:

3958

result:

ok single line: '3958'

Test #26:

score: 1
Accepted
time: 3ms
memory: 57264kb

input:

40 39
22 26
15 18
8 1
22 9
14 30
33 10
34 21
4 31
33 17
1 5
9 5
34 35
9 28
20 16
24 13
27 7
37 22
2 26
29 22
38 10
22 13
38 40
18 34
27 39
25 2
37 39
34 36
11 4
23 3
16 10
10 19
3 18
21 9
37 12
30 13
9 4
39 6
38 35
21 32

output:

9139

result:

ok single line: '9139'

Subtask #2:

score: 1
Accepted

Test #27:

score: 1
Accepted
time: 7ms
memory: 60188kb

input:

196 599
86 111
68 176
32 111
105 146
183 179
193 48
3 101
61 173
16 134
147 123
129 168
113 34
98 90
103 91
140 93
89 38
137 110
39 62
165 119
54 22
65 70
91 49
135 48
20 167
108 62
169 71
188 8
191 132
63 108
56 194
40 133
171 61
40 79
134 12
165 151
62 141
9 84
170 2
174 72
52 47
58 9
30 138
68 53...

output:

362371

result:

ok single line: '362371'

Test #28:

score: 1
Accepted
time: 7ms
memory: 57356kb

input:

197 599
106 89
188 100
82 104
104 36
175 109
159 106
55 188
13 86
74 80
10 77
16 154
128 159
28 165
83 91
112 187
143 103
87 195
156 129
11 59
164 53
86 82
66 58
54 180
142 151
177 37
121 57
41 64
52 185
164 57
190 146
166 178
53 90
80 166
132 21
14 143
77 195
161 122
162 31
172 55
182 142
101 119
4...

output:

535518

result:

ok single line: '535518'

Test #29:

score: 1
Accepted
time: 3ms
memory: 57528kb

input:

200 598
188 148
39 175
71 128
16 48
100 182
160 76
197 140
134 106
50 138
164 55
149 91
103 34
20 159
149 21
175 37
105 141
120 150
102 3
101 66
9 132
24 20
119 67
104 99
51 125
68 69
73 108
191 58
80 151
10 4
23 14
2 112
36 9
102 189
123 17
4 82
55 35
45 154
191 87
193 180
190 145
50 76
172 23
24 8...

output:

2405

result:

ok single line: '2405'

Test #30:

score: 1
Accepted
time: 7ms
memory: 61096kb

input:

200 600
132 43
177 122
21 63
118 161
107 81
96 148
170 196
162 183
13 147
131 5
15 155
199 58
48 97
57 132
115 188
169 195
95 113
130 187
42 145
130 13
98 162
81 150
9 151
119 107
27 135
90 103
156 24
157 13
189 48
183 106
160 157
6 180
114 189
195 70
139 111
142 18
114 139
156 39
77 14
118 39
73 17...

output:

184487

result:

ok single line: '184487'

Test #31:

score: 1
Accepted
time: 7ms
memory: 57192kb

input:

200 600
184 166
26 196
62 6
139 121
189 37
13 25
28 141
45 90
116 163
149 49
104 200
29 196
116 120
17 115
120 137
124 35
112 182
26 142
26 142
123 67
143 189
165 35
92 44
89 105
133 14
9 158
182 154
41 136
165 35
186 31
42 65
4 36
104 11
83 82
118 112
18 160
72 40
120 165
152 134
192 140
189 37
195...

output:

546865

result:

ok single line: '546865'

Test #32:

score: 1
Accepted
time: 4ms
memory: 57904kb

input:

200 600
82 22
156 78
136 193
63 136
152 154
109 48
79 127
87 77
142 100
137 163
73 24
75 150
178 52
124 47
160 104
47 176
198 156
9 26
16 138
11 39
28 102
170 56
72 144
25 85
158 18
117 80
3 115
33 175
10 110
35 90
161 164
165 55
71 191
160 87
70 150
31 113
158 181
192 96
35 80
138 16
75 150
97 96
1...

output:

8455

result:

ok single line: '8455'

Test #33:

score: 1
Accepted
time: 3ms
memory: 56332kb

input:

200 300
21 137
147 99
110 159
136 77
77 95
29 97
163 13
59 178
175 16
109 27
4 158
37 79
58 41
9 40
143 51
182 131
154 185
193 188
31 6
176 166
127 196
180 169
184 139
59 84
37 80
21 144
48 39
45 18
81 139
31 164
191 62
145 152
194 168
8 63
125 115
179 109
175 44
99 162
38 83
180 125
109 119
98 174
...

output:

298

result:

ok single line: '298'

Test #34:

score: 1
Accepted
time: 4ms
memory: 56420kb

input:

200 300
157 130
22 189
160 143
89 9
172 119
68 197
66 32
40 173
10 35
70 90
154 143
86 158
174 42
17 186
181 45
49 42
54 114
61 153
65 179
150 13
41 154
73 106
54 92
165 187
46 190
41 56
164 29
71 157
78 123
176 75
122 32
59 178
178 116
96 177
176 22
11 194
2 87
135 80
189 3
57 60
16 130
192 136
105...

output:

298

result:

ok single line: '298'

Test #35:

score: 1
Accepted
time: 7ms
memory: 60976kb

input:

200 300
173 87
53 175
138 8
82 171
168 170
77 36
31 143
80 165
190 189
121 114
191 132
20 124
75 183
69 1
18 67
35 162
62 155
163 47
108 23
26 40
157 173
173 79
134 66
177 40
94 142
116 34
86 76
54 41
49 158
172 31
23 187
83 54
120 62
88 107
182 174
42 102
11 71
110 25
154 186
162 58
139 88
139 193
...

output:

298

result:

ok single line: '298'

Test #36:

score: 1
Accepted
time: 4ms
memory: 58776kb

input:

199 297
155 128
88 116
106 7
7 78
35 6
179 25
198 41
144 85
74 118
24 91
62 163
106 56
112 132
90 27
58 3
132 90
40 62
155 112
111 151
173 72
26 121
68 12
10 93
104 19
107 43
143 107
68 186
26 152
53 179
1 185
159 184
95 60
115 157
71 152
14 160
62 130
181 190
187 108
120 82
58 50
42 183
18 5
170 84...

output:

2700

result:

ok single line: '2700'

Test #37:

score: 1
Accepted
time: 3ms
memory: 61376kb

input:

199 297
102 43
2 149
100 161
30 148
54 45
138 143
111 94
110 43
132 63
51 113
2 131
109 166
41 179
108 66
67 69
82 91
196 119
42 61
74 43
2 68
129 48
72 152
159 177
89 71
159 154
76 30
181 10
188 155
37 47
22 198
87 183
8 52
14 133
1 36
19 103
106 15
196 98
129 26
56 92
150 96
36 123
44 101
138 127
...

output:

1775

result:

ok single line: '1775'

Test #38:

score: 1
Accepted
time: 3ms
memory: 57476kb

input:

199 297
79 177
80 141
175 129
166 183
50 78
35 177
155 35
49 118
95 92
172 32
161 27
188 68
132 195
18 2
19 193
151 124
182 159
145 197
54 64
29 139
134 13
72 7
159 81
15 136
183 142
23 60
171 109
107 33
119 59
8 76
65 11
70 71
192 6
42 11
120 112
164 140
127 93
31 68
146 133
23 66
29 100
118 135
36...

output:

2084

result:

ok single line: '2084'

Test #39:

score: 1
Accepted
time: 4ms
memory: 58760kb

input:

200 300
112 187
6 84
50 72
77 86
53 172
197 145
30 195
156 83
5 24
171 156
60 19
116 96
188 104
21 83
144 185
27 172
124 138
132 180
4 42
31 39
8 133
108 183
54 144
134 191
27 60
199 139
142 182
61 180
101 109
76 49
154 59
127 121
173 65
143 160
6 45
190 135
122 195
29 163
129 93
76 28
170 153
167 1...

output:

298

result:

ok single line: '298'

Test #40:

score: 1
Accepted
time: 3ms
memory: 58276kb

input:

200 332
7 158
140 47
62 175
173 22
199 62
179 169
100 5
69 34
174 60
4 56
12 140
150 123
76 67
133 129
34 108
119 139
98 110
6 174
1 99
65 70
23 43
15 131
140 121
93 5
101 133
172 197
199 169
191 19
89 18
168 166
38 64
72 73
194 48
50 154
150 186
39 176
114 133
32 194
199 169
19 77
97 189
123 63
175...

output:

2252697

result:

ok single line: '2252697'

Test #41:

score: 1
Accepted
time: 0ms
memory: 57372kb

input:

200 459
55 172
184 187
10 179
142 23
155 119
38 17
184 108
188 167
155 137
174 112
64 138
187 90
26 12
8 161
153 83
38 61
3 17
17 30
183 108
159 58
191 186
98 111
67 168
33 120
39 178
110 168
126 107
189 22
170 185
72 97
186 198
172 110
118 129
152 34
33 179
55 47
143 157
78 121
44 170
104 85
120 33...

output:

3054618

result:

ok single line: '3054618'

Test #42:

score: 1
Accepted
time: 3ms
memory: 56540kb

input:

200 559
88 140
56 21
52 5
5 2
83 182
77 58
95 27
98 197
181 88
155 145
67 75
195 27
121 175
91 137
175 92
8 88
115 34
191 8
113 154
128 174
198 115
81 18
38 183
54 157
95 12
198 41
51 37
99 116
164 162
80 129
31 142
18 81
11 124
181 134
104 20
116 45
65 81
120 32
58 4
97 57
74 54
71 166
174 98
57 8
...

output:

2883685

result:

ok single line: '2883685'

Test #43:

score: 1
Accepted
time: 7ms
memory: 57284kb

input:

200 600
196 118
93 146
130 152
76 140
200 58
95 170
175 172
148 188
42 8
30 197
99 30
37 190
120 94
154 23
76 88
41 197
82 58
195 144
63 38
177 105
180 157
6 158
173 159
17 64
163 25
58 82
127 102
196 28
178 155
82 58
191 63
197 41
63 96
109 69
5 21
149 132
58 82
110 47
157 180
197 68
159 173
170 11...

output:

4986139

result:

ok single line: '4986139'

Test #44:

score: 1
Accepted
time: 3ms
memory: 56464kb

input:

200 600
177 123
170 12
134 125
57 40
82 94
25 45
134 107
70 33
26 104
77 83
38 50
100 7
71 174
46 60
131 180
32 123
45 130
79 186
170 103
11 85
10 35
25 2
133 55
69 144
171 131
149 20
67 157
56 58
3 110
161 138
46 199
130 42
24 158
183 132
77 83
154 180
127 176
106 38
62 85
11 85
136 155
136 155
172...

output:

4162448

result:

ok single line: '4162448'

Test #45:

score: 1
Accepted
time: 7ms
memory: 60988kb

input:

195 600
27 178
146 66
86 41
112 51
110 82
122 154
12 169
137 122
170 87
82 110
160 172
186 190
153 71
137 122
21 134
110 82
156 139
131 129
83 89
30 72
88 6
129 14
71 142
73 125
191 16
33 142
23 189
105 177
46 134
148 165
8 128
146 110
172 135
53 182
12 52
101 8
138 15
31 55
3 94
185 137
134 21
45 1...

output:

3669804

result:

ok single line: '3669804'

Test #46:

score: 1
Accepted
time: 0ms
memory: 56368kb

input:

200 299
15 172
45 9
145 109
137 192
127 170
47 22
24 125
6 112
116 91
186 129
24 113
79 84
141 154
92 83
200 122
115 150
56 195
149 130
40 37
198 114
74 177
89 148
78 130
151 191
118 108
9 177
88 142
120 36
76 25
173 8
63 51
159 91
189 7
128 39
133 151
115 5
19 99
83 146
58 64
89 145
193 182
8 30
13...

output:

893

result:

ok single line: '893'

Test #47:

score: 1
Accepted
time: 7ms
memory: 60968kb

input:

200 299
1 161
26 134
179 31
111 128
171 131
80 184
137 86
117 53
157 198
60 98
130 142
196 166
76 20
89 100
69 57
37 103
28 57
114 176
22 124
52 192
129 23
157 151
5 161
123 118
180 63
70 172
152 169
131 94
169 167
19 147
31 79
200 62
143 194
49 158
68 162
79 22
188 37
39 78
197 9
3 183
21 191
188 1...

output:

825

result:

ok single line: '825'

Test #48:

score: 1
Accepted
time: 10ms
memory: 58980kb

input:

200 329
44 9
166 34
96 107
97 58
17 106
153 27
65 188
192 35
138 53
76 133
198 86
121 34
175 52
85 50
12 115
62 133
11 66
139 32
108 64
67 29
176 29
42 99
124 179
122 156
127 67
116 196
28 180
69 155
191 163
64 170
32 184
140 129
168 123
57 48
58 31
164 77
5 160
111 28
135 111
31 66
158 109
141 153
...

output:

116253

result:

ok single line: '116253'

Test #49:

score: 1
Accepted
time: 3ms
memory: 57928kb

input:

200 329
79 144
17 144
184 179
130 71
168 119
56 118
194 149
31 123
46 96
118 143
7 64
20 164
1 40
107 180
87 84
184 159
143 106
38 113
105 62
85 124
12 135
18 30
150 109
181 97
116 50
4 16
173 137
112 114
79 99
172 49
128 46
179 159
198 111
196 50
161 175
167 47
105 74
47 177
125 96
82 14
72 80
86 2...

output:

111697

result:

ok single line: '111697'

Test #50:

score: 1
Accepted
time: 4ms
memory: 52184kb

input:

200 200
31 195
32 96
112 86
30 16
15 85
82 16
58 65
59 2
100 147
62 179
105 15
26 110
153 186
124 181
85 49
108 157
120 140
36 101
37 8
38 66
20 53
117 68
51 200
190 69
132 21
84 70
177 91
195 33
41 50
168 49
160 177
56 176
178 31
152 161
98 44
90 156
80 192
138 183
56 60
125 154
103 25
3 180
132 52...

output:

1313400

result:

ok single line: '1313400'

Test #51:

score: 1
Accepted
time: 0ms
memory: 61356kb

input:

180 270
10 58
154 177
78 3
171 65
109 95
92 28
14 180
48 141
65 132
20 121
87 144
143 73
180 130
124 28
77 155
23 137
150 179
172 132
114 44
40 177
10 117
90 69
37 63
20 36
180 122
93 16
148 76
79 74
178 20
158 24
65 125
144 87
140 90
54 164
68 11
21 81
133 112
26 9
111 6
85 139
28 151
6 138
136 135...

output:

1477453

result:

ok single line: '1477453'

Test #52:

score: 1
Accepted
time: 3ms
memory: 58876kb

input:

180 255
88 118
171 142
63 40
112 104
166 131
124 53
154 88
1 94
154 88
178 106
93 66
20 79
78 81
130 69
118 162
170 131
33 138
70 86
91 138
29 127
4 135
164 27
44 136
42 151
127 66
93 127
48 72
22 35
92 54
13 68
126 174
31 6
2 139
3 128
175 108
99 158
80 85
137 115
105 120
97 44
132 34
56 144
148 65...

output:

1192973

result:

ok single line: '1192973'

Subtask #3:

score: 1
Accepted

Test #53:

score: 1
Accepted
time: 12ms
memory: 58232kb

input:

998 3000
233 962
435 623
229 654
54 639
799 29
958 154
144 444
23 464
451 699
835 85
272 722
20 226
547 206
616 795
252 964
18 14
447 392
316 681
16 526
359 2
428 382
549 498
78 930
811 610
663 871
16 848
330 202
875 644
334 949
36 698
849 763
654 619
873 259
630 517
410 740
133 600
636 191
997 87
8...

output:

58333417

result:

ok single line: '58333417'

Test #54:

score: 1
Accepted
time: 8ms
memory: 60808kb

input:

1000 2999
490 439
536 98
400 332
307 197
330 658
429 868
659 684
140 608
80 923
440 675
663 533
712 526
703 725
87 714
936 458
143 841
895 76
220 977
129 771
226 707
638 117
412 926
565 487
16 133
269 941
800 826
606 319
773 644
127 961
507 741
817 135
250 155
504 343
142 785
433 576
753 396
860 133...

output:

31477399

result:

ok single line: '31477399'

Test #55:

score: 1
Accepted
time: 4ms
memory: 59144kb

input:

997 3000
596 509
994 252
580 39
587 41
247 313
622 805
717 470
349 774
836 598
100 129
432 696
890 434
830 971
977 492
1 664
86 712
368 959
818 43
324 328
213 760
844 428
882 463
570 26
370 228
585 114
83 269
95 984
661 887
804 607
578 128
722 114
530 73
272 800
238 76
562 586
395 881
857 204
205 47...

output:

27038858

result:

ok single line: '27038858'

Test #56:

score: 1
Accepted
time: 3ms
memory: 58180kb

input:

1000 2999
511 742
48 250
874 756
501 907
870 748
343 116
265 661
351 736
658 802
996 6
447 425
334 992
136 751
487 109
196 254
803 136
388 98
963 78
957 23
939 675
874 105
154 60
580 796
15 594
209 521
853 246
405 651
618 583
611 646
722 758
373 765
404 407
859 719
65 944
437 262
508 219
723 120
981...

output:

31489381

result:

ok single line: '31489381'

Test #57:

score: 1
Accepted
time: 4ms
memory: 58052kb

input:

1000 3000
349 449
637 915
495 765
837 122
515 220
701 52
106 858
64 87
37 157
727 204
705 460
122 43
204 567
961 12
81 171
623 279
339 284
475 639
603 226
431 363
302 269
563 270
981 731
915 79
386 799
831 140
479 614
802 464
769 720
676 286
994 524
330 680
762 229
925 721
231 123
100 229
671 233
32...

output:

31552291

result:

ok single line: '31552291'

Test #58:

score: 1
Accepted
time: 8ms
memory: 57708kb

input:

1000 2998
398 993
344 561
412 41
207 621
62 943
701 451
672 225
91 818
743 336
732 425
42 860
852 231
610 652
381 623
991 230
325 884
170 963
152 229
524 428
704 743
680 968
434 756
56 828
474 974
827 877
396 913
510 558
62 554
164 968
475 183
469 626
154 183
508 946
242 240
623 160
60 41
844 348
49...

output:

177049

result:

ok single line: '177049'

Test #59:

score: 1
Accepted
time: 4ms
memory: 59324kb

input:

1000 1500
726 523
149 216
790 197
794 185
962 838
237 139
529 8
212 318
715 322
918 881
256 626
144 11
107 688
501 152
945 925
91 804
366 835
901 663
595 613
425 701
798 611
423 770
25 669
395 66
931 808
406 345
282 65
482 104
443 910
379 449
850 973
89 601
521 470
665 22
364 84
873 605
910 167
870 ...

output:

1498

result:

ok single line: '1498'

Test #60:

score: 1
Accepted
time: 3ms
memory: 56688kb

input:

1000 1500
701 20
613 695
760 842
5 784
1 8
655 510
115 386
903 334
321 731
431 400
755 504
590 983
74 478
211 556
941 538
785 671
21 489
364 365
579 803
893 883
594 105
801 64
411 194
887 673
326 775
982 581
995 286
37 97
866 256
666 244
250 320
243 648
233 433
587 864
230 561
225 599
829 160
87 949...

output:

1498

result:

ok single line: '1498'

Test #61:

score: 1
Accepted
time: 4ms
memory: 58860kb

input:

1000 1500
287 339
632 966
179 246
506 443
374 228
204 337
858 736
907 372
136 244
391 302
748 738
528 358
633 924
393 25
397 559
998 163
657 600
513 472
873 757
613 692
739 171
264 292
561 252
6 47
147 572
564 732
152 283
539 285
262 490
446 229
19 341
929 383
889 622
100 83
809 350
832 458
909 274
...

output:

1498

result:

ok single line: '1498'

Test #62:

score: 1
Accepted
time: 7ms
memory: 58424kb

input:

999 1497
390 274
583 520
969 429
817 556
532 583
212 437
420 809
22 11
976 685
471 553
890 984
549 539
332 606
345 977
207 98
879 749
858 986
399 443
113 371
156 320
877 355
952 790
145 807
789 237
998 340
159 721
146 445
734 186
387 338
517 159
179 746
446 649
73 150
71 577
181 23
160 321
597 467
6...

output:

18014

result:

ok single line: '18014'

Test #63:

score: 1
Accepted
time: 14ms
memory: 57616kb

input:

999 1497
591 268
399 993
857 723
930 801
520 456
647 387
159 329
432 98
174 92
926 703
40 582
977 541
813 479
287 65
187 113
402 463
231 625
343 700
349 284
308 42
296 318
246 672
618 261
255 180
329 252
77 83
338 397
263 51
821 836
697 224
283 879
110 809
199 954
379 809
726 303
581 498
694 17
116 ...

output:

7479

result:

ok single line: '7479'

Test #64:

score: 1
Accepted
time: 12ms
memory: 61352kb

input:

999 1497
997 395
412 270
966 34
401 719
106 757
217 854
146 323
568 109
8 123
377 824
624 561
475 134
124 511
703 671
125 435
19 183
754 747
492 591
716 768
685 756
264 788
472 373
513 936
170 679
302 843
99 694
662 819
621 178
154 656
469 931
780 306
598 499
488 820
920 769
490 455
954 113
858 227
...

output:

11979

result:

ok single line: '11979'

Test #65:

score: 1
Accepted
time: 7ms
memory: 58484kb

input:

1000 1500
210 504
69 269
363 719
923 451
772 235
708 834
680 337
281 436
295 885
442 579
417 174
855 49
497 435
606 119
723 98
334 397
116 658
354 255
555 635
294 260
874 162
445 469
525 377
804 950
708 633
15 275
469 321
448 528
467 297
975 790
864 591
348 782
81 77
73 754
912 247
111 366
609 448
8...

output:

1498

result:

ok single line: '1498'

Test #66:

score: 1
Accepted
time: 7ms
memory: 58108kb

input:

1000 1653
427 444
506 128
781 697
656 55
827 726
566 242
191 965
61 200
29 747
798 796
863 776
128 161
431 186
805 546
690 90
742 566
108 984
115 648
477 75
806 750
163 137
322 864
392 899
617 198
893 473
662 988
151 119
233 495
713 461
665 220
64 304
607 156
10 540
831 155
840 491
55 493
614 119
69...

output:

260491928

result:

ok single line: '260491928'

Test #67:

score: 1
Accepted
time: 3ms
memory: 57480kb

input:

1000 2248
382 666
347 2
837 157
701 489
781 221
337 467
668 568
809 416
539 582
900 41
56 273
513 432
959 891
498 65
485 424
301 974
765 120
74 780
324 622
365 158
131 167
745 964
360 725
837 576
284 934
173 789
616 71
428 594
924 344
258 739
771 507
58 605
867 550
846 288
634 360
191 38
459 658
493...

output:

352399300

result:

ok single line: '352399300'

Test #68:

score: 1
Accepted
time: 8ms
memory: 57568kb

input:

1000 2923
351 40
276 245
135 498
748 857
222 864
818 759
582 842
10 760
889 930
232 389
990 633
969 867
818 354
560 302
633 293
301 726
868 896
658 651
800 921
662 120
603 911
422 181
149 896
132 302
35 392
943 32
166 157
174 486
959 734
764 355
195 577
352 708
316 297
952 489
686 599
829 941
812 20...

output:

336860760

result:

ok single line: '336860760'

Test #69:

score: 1
Accepted
time: 8ms
memory: 58240kb

input:

999 2995
560 667
280 808
948 346
567 463
644 276
121 69
397 417
954 119
216 759
700 585
240 63
996 626
761 967
599 414
280 262
363 379
767 720
95 121
850 715
171 809
830 969
706 663
634 669
855 113
935 601
305 815
701 738
275 898
380 677
679 261
488 250
388 422
1 325
394 983
443 647
29 387
418 278
7...

output:

533867978

result:

ok single line: '533867978'

Test #70:

score: 1
Accepted
time: 7ms
memory: 60644kb

input:

1000 3000
404 867
2 646
508 289
248 657
724 336
302 565
673 715
86 925
925 105
64 898
453 886
52 563
358 456
783 77
46 732
761 397
258 773
994 140
223 421
798 54
689 371
113 469
175 539
371 802
347 77
41 584
946 491
286 117
374 892
869 977
258 823
925 105
1000 275
535 568
656 121
233 424
204 205
703...

output:

634021047

result:

ok single line: '634021047'

Test #71:

score: 1
Accepted
time: 3ms
memory: 57796kb

input:

1000 3000
832 107
242 891
857 446
640 13
265 63
90 376
781 526
441 77
127 514
308 142
621 605
804 910
902 85
879 963
169 490
682 979
665 349
761 161
677 603
265 63
224 87
70 578
46 402
492 767
394 2
100 292
178 111
462 757
653 671
388 835
198 339
18 237
256 156
680 640
239 64
321 574
376 755
582 182...

output:

572719395

result:

ok single line: '572719395'

Test #72:

score: 1
Accepted
time: 8ms
memory: 58060kb

input:

1000 1499
440 145
987 212
963 595
247 207
167 765
194 699
267 416
122 799
310 89
746 957
692 396
778 16
830 762
497 742
401 142
935 831
956 380
719 865
438 436
910 447
895 846
596 75
615 745
749 893
652 597
341 210
338 78
623 838
263 336
410 414
304 397
108 66
54 105
368 853
350 279
788 42
285 787
6...

output:

4493

result:

ok single line: '4493'

Test #73:

score: 1
Accepted
time: 8ms
memory: 58028kb

input:

1000 1499
754 321
492 250
968 724
401 934
786 524
457 101
682 810
738 221
709 133
189 771
330 392
992 565
609 925
612 452
607 618
131 144
494 758
933 55
652 463
525 796
674 354
509 744
58 225
877 784
72 474
913 398
550 613
766 62
31 848
47 830
879 373
750 288
646 258
837 958
849 144
288 588
536 40
4...

output:

4058

result:

ok single line: '4058'

Test #74:

score: 1
Accepted
time: 5ms
memory: 57580kb

input:

986 1639
879 366
740 198
355 906
324 27
667 249
922 110
792 89
216 721
572 385
323 203
816 912
535 867
294 457
659 861
881 23
887 499
754 104
154 513
498 877
182 623
812 684
928 400
104 41
468 517
856 553
563 308
910 119
925 135
254 135
985 721
442 671
223 521
321 57
841 811
327 2
284 270
902 57
559...

output:

2893481

result:

ok single line: '2893481'

Test #75:

score: 1
Accepted
time: 8ms
memory: 61392kb

input:

998 1659
491 533
348 877
957 518
981 419
49 651
870 464
588 704
973 995
761 964
609 813
213 941
615 894
961 65
374 657
241 690
539 739
434 836
784 6
567 209
171 644
959 668
501 50
77 866
678 553
593 206
950 102
389 917
998 805
794 520
74 966
725 267
548 338
983 785
660 204
33 73
43 664
496 73
804 87...

output:

2822843

result:

ok single line: '2822843'

Test #76:

score: 1
Accepted
time: 3ms
memory: 60392kb

input:

998 1659
743 360
901 592
398 324
399 936
807 643
912 168
457 37
467 88
197 390
427 843
8 797
419 463
361 534
254 834
506 926
124 133
544 153
876 406
901 690
101 822
669 297
754 910
170 218
719 667
636 357
191 510
376 132
738 469
20 395
920 915
810 127
986 238
508 443
537 757
818 894
546 977
748 794
...

output:

2766522

result:

ok single line: '2766522'

Test #77:

score: 1
Accepted
time: 7ms
memory: 56604kb

input:

999 1662
613 460
551 477
247 707
228 8
892 445
566 460
445 203
602 445
570 933
319 445
866 444
277 35
172 987
671 558
376 110
650 572
2 354
240 298
873 44
131 90
445 441
399 878
247 227
76 51
624 916
209 397
835 894
806 460
122 87
55 882
809 725
345 879
151 632
460 564
778 660
345 797
573 306
672 77...

output:

569033

result:

ok single line: '569033'

Test #78:

score: 1
Accepted
time: 7ms
memory: 61460kb

input:

976 1497
374 236
385 806
186 314
648 139
737 249
50 808
708 77
397 20
67 328
818 338
786 489
859 776
636 332
624 265
7 159
491 516
307 526
749 852
91 501
600 192
951 945
18 310
895 592
748 230
49 278
297 299
169 23
511 759
627 729
7 690
270 742
834 815
431 851
375 679
182 330
225 670
780 783
925 850...

output:

203090614

result:

ok single line: '203090614'

Subtask #4:

score: 1
Accepted

Test #79:

score: 1
Accepted
time: 13ms
memory: 59940kb

input:

3000 10000
1462 2456
1392 440
1583 2589
2538 688
1567 2535
191 2866
2383 588
2559 2490
769 1534
412 709
2592 2349
1997 72
2716 1097
702 1512
2166 1393
2968 62
184 1684
2787 669
605 2542
340 1029
1681 1984
897 2794
2187 2410
2014 2564
476 2313
883 143
2971 2828
1494 2144
1797 1735
2055 1685
311 2511
...

output:

848984993

result:

ok single line: '848984993'

Test #80:

score: 1
Accepted
time: 15ms
memory: 62076kb

input:

3000 10000
1026 1160
2232 980
2905 2477
1395 1586
1776 2162
675 2729
2306 1958
559 2089
551 1043
1122 1397
1871 2324
1662 27
1539 920
1178 183
333 1005
2775 1265
1034 716
142 2518
1211 918
418 1013
604 614
2236 2771
204 863
940 203
2536 1501
1530 823
268 1664
1680 367
2132 744
2429 22
1823 1743
2766...

output:

350484542

result:

ok single line: '350484542'

Test #81:

score: 1
Accepted
time: 12ms
memory: 58464kb

input:

2998 9149
2723 73
2877 1300
1841 932
1431 2571
1951 724
2203 1887
2139 1215
2730 1694
2349 413
471 1161
898 2623
1152 427
1603 147
2329 373
2179 1430
1032 1925
447 476
5 1194
2924 1878
2925 1567
1913 1111
2318 1645
380 2615
394 1866
767 902
2286 1673
2790 1587
2647 1782
2467 2065
2099 1469
303 1987
...

output:

794269949

result:

ok single line: '794269949'

Test #82:

score: 1
Accepted
time: 15ms
memory: 61592kb

input:

2998 10000
1258 1679
2751 621
1241 2056
23 2391
2158 61
1426 1343
201 1641
1970 2574
2643 1757
1819 1635
803 1636
1612 387
543 1829
1631 741
1030 2761
2788 2367
1795 538
1444 2515
2814 833
1158 2295
1657 2465
707 1181
2516 2182
220 2825
2719 392
988 924
2484 1503
1097 438
896 1237
1886 1931
348 437
...

output:

649634712

result:

ok single line: '649634712'

Test #83:

score: 1
Accepted
time: 9ms
memory: 59212kb

input:

3000 10000
848 2755
2804 1912
1776 1288
683 22
1224 2504
2375 834
292 2954
1700 1620
2094 1679
119 2190
196 2413
1157 2913
854 7
1985 1629
302 848
203 1653
1241 569
2735 1933
1913 2433
1924 1416
474 508
10 2676
2201 1688
306 1450
2447 1852
442 2321
398 2476
277 1220
1220 2438
1527 1637
1897 1905
121...

output:

500169597

result:

ok single line: '500169597'

Test #84:

score: 1
Accepted
time: 14ms
memory: 58892kb

input:

3000 10000
367 888
1051 1569
1070 2489
2703 950
2812 1607
2180 1965
2404 997
2314 104
2733 692
2177 1425
2580 1134
2120 631
1438 2113
1610 2622
1300 592
752 2283
2767 1663
1013 2650
2237 2403
2927 2723
2556 1598
276 2440
1172 2006
1899 411
809 87
109 1326
464 2126
2842 67
430 1644
222 2739
14 151
17...

output:

770159

result:

ok single line: '770159'

Test #85:

score: 1
Accepted
time: 7ms
memory: 56636kb

input:

3000 4500
2477 2827
2845 979
1375 937
1504 1754
2185 867
2148 2008
668 1821
2471 561
2541 2603
2693 2256
981 951
2549 2406
1202 282
946 2493
1357 137
658 1534
1370 1224
303 1883
217 2122
2632 2814
2249 682
2387 1136
140 2143
2350 2168
856 2574
2268 1086
1059 223
2605 2022
780 1446
1267 2619
2023 115...

output:

4498

result:

ok single line: '4498'

Test #86:

score: 1
Accepted
time: 7ms
memory: 60232kb

input:

3000 4500
443 1521
2611 1005
113 1880
2322 1285
2058 2789
462 2092
2106 362
2167 518
2600 40
2625 193
2163 1418
713 687
1930 2085
979 760
1028 787
1387 2543
1829 1597
1018 2815
889 2369
1289 291
119 2142
1752 489
141 385
1765 1315
1279 1073
1838 2873
298 2110
1943 1271
2680 2762
699 2245
1334 1134
1...

output:

4498

result:

ok single line: '4498'

Test #87:

score: 1
Accepted
time: 11ms
memory: 56648kb

input:

3000 4500
2013 1627
987 2831
2780 1727
1917 2787
2982 862
1791 2015
1926 2338
889 2124
255 1581
2038 1678
2889 2719
1863 1415
1548 2823
1531 209
844 2811
2285 2242
1293 208
92 1031
228 426
222 1760
2820 897
2628 1985
1182 2597
2296 1286
17 2957
1805 340
1974 443
400 223
640 272
270 1066
1952 8
851 2...

output:

4498

result:

ok single line: '4498'

Test #88:

score: 1
Accepted
time: 11ms
memory: 58944kb

input:

2999 4497
536 126
1348 737
2520 2444
1821 2721
2068 235
51 382
2392 74
287 1547
1859 2278
497 2786
1675 1401
1661 1726
2539 1730
2117 213
528 1536
263 2192
904 133
321 446
141 550
254 1032
49 2626
2635 296
554 1307
1503 2480
1210 794
2301 164
2791 1818
2678 2838
2923 1792
434 2933
715 964
1189 1663
...

output:

58533

result:

ok single line: '58533'

Test #89:

score: 1
Accepted
time: 7ms
memory: 57392kb

input:

2999 4497
1790 282
1481 1228
2364 977
1376 102
1319 753
473 1361
1073 1259
2825 1411
381 770
1226 1547
2733 1767
1490 613
113 1073
1669 942
999 2175
2224 370
1494 1895
1136 1281
574 1200
1456 1143
477 98
2223 2688
1408 1977
2301 1256
1725 1672
2180 2304
1010 1958
708 661
134 1206
1939 356
1756 2800
...

output:

22480

result:

ok single line: '22480'

Test #90:

score: 1
Accepted
time: 8ms
memory: 59592kb

input:

2999 4497
1137 1373
237 126
2712 2868
2056 2922
1090 462
930 958
2631 1771
1867 1856
847 755
56 2803
1048 603
434 1580
181 1328
1423 2806
646 1966
2841 357
2566 1681
2461 500
1954 2587
1074 1025
544 1696
498 2644
2340 2903
577 1875
2299 2457
679 993
1241 1061
1797 978
2852 2179
1692 2958
129 772
250...

output:

31481

result:

ok single line: '31481'

Test #91:

score: 1
Accepted
time: 7ms
memory: 57280kb

input:

3000 4500
311 2871
1161 1242
2957 104
2729 290
1873 1765
2305 2712
1316 2648
1327 298
1319 2997
1760 1389
2365 1226
1860 2756
2636 19
268 1355
310 1822
410 1066
2641 97
2886 230
2857 274
2533 1363
1301 526
814 1301
543 2351
1878 906
1107 2833
1153 2500
2595 168
548 2096
2727 692
803 487
2140 386
689...

output:

4498

result:

ok single line: '4498'

Test #92:

score: 1
Accepted
time: 10ms
memory: 58204kb

input:

2997 5331
2171 723
1973 430
2279 2344
2281 2423
1713 2195
515 110
1150 98
2354 1629
495 2141
524 2753
610 2705
2874 917
2301 2871
853 1509
2678 288
290 1016
1071 1004
2169 923
2311 181
2923 750
2983 630
1742 1774
1832 2191
1348 971
56 1128
79 1879
2096 883
2012 969
1719 2108
2777 2381
1308 1860
373 ...

output:

7028318840

result:

ok single line: '7028318840'

Test #93:

score: 1
Accepted
time: 16ms
memory: 57348kb

input:

3000 7616
1981 2729
1342 2278
96 2344
967 2741
2175 2020
382 806
867 2232
576 957
2200 906
79 183
1528 1763
2983 680
95 1149
115 2099
806 2707
951 598
1493 582
1514 1896
1993 538
2605 76
556 1745
1140 1332
1266 300
2312 720
59 1919
2703 2358
2206 1452
2582 607
479 1034
614 2009
1474 1913
772 994
236...

output:

9429421366

result:

ok single line: '9429421366'

Test #94:

score: 1
Accepted
time: 13ms
memory: 57768kb

input:

3000 9993
2352 807
2235 2186
1112 48
922 1128
407 294
1159 1450
1355 139
188 2905
199 2086
2911 665
2403 1253
2449 833
1681 883
1921 961
2094 917
2768 1860
1507 1841
1691 982
106 1525
1795 1862
1569 707
2634 1030
1051 2487
2796 288
149 1676
1377 30
2258 1303
2713 1433
980 126
545 1924
2079 302
777 1...

output:

10125518520

result:

ok single line: '10125518520'

Test #95:

score: 1
Accepted
time: 11ms
memory: 62048kb

input:

3000 10000
2808 1645
1315 807
1325 938
88 1021
1552 406
2337 208
31 72
1786 2219
1447 257
575 2509
2953 1158
243 146
615 1555
226 2541
1054 1600
1785 1825
2701 427
1995 2542
2908 1934
684 1762
1699 2551
420 2121
2527 361
2345 2313
2417 2642
596 2512
1121 1543
1397 1401
273 1518
1061 1175
1713 2528
9...

output:

14793095471

result:

ok single line: '14793095471'

Test #96:

score: 1
Accepted
time: 12ms
memory: 58780kb

input:

3000 10000
2368 2954
485 1685
2882 1645
1469 1996
221 524
172 759
2350 324
190 794
2477 2981
261 591
556 146
1885 176
975 1011
2000 2884
111 1374
1328 2954
810 2774
1465 654
2674 427
1934 2412
1239 158
1900 287
2397 1966
2945 1971
936 2539
317 2993
1352 311
356 333
2449 2307
2456 2943
1330 2865
1725...

output:

14040046478

result:

ok single line: '14040046478'

Test #97:

score: 1
Accepted
time: 13ms
memory: 57676kb

input:

2995 10000
2794 2544
1010 282
2832 1749
2016 183
1980 572
1721 1622
1985 1769
483 113
456 1041
479 80
1305 950
592 2649
2311 2642
983 2992
1638 143
2088 2642
693 2367
1654 885
1900 1141
912 2203
1921 495
400 2182
911 432
1552 1869
355 2724
2062 852
2055 2311
358 1262
208 2275
889 2403
1462 1595
2711...

output:

14275525314

result:

ok single line: '14275525314'

Test #98:

score: 1
Accepted
time: 15ms
memory: 61044kb

input:

3000 4499
918 960
464 1159
721 1248
1973 48
2638 494
176 2639
960 1274
2799 791
2926 2526
1038 212
774 803
1012 2646
2457 2910
1692 1889
910 1289
2967 2310
1209 2414
1975 2364
240 2801
2938 1187
2219 2904
2314 2976
1841 1154
193 601
2370 1614
2557 2277
975 301
2333 1206
2985 2899
861 686
2296 226
84...

output:

13493

result:

ok single line: '13493'

Test #99:

score: 1
Accepted
time: 11ms
memory: 57340kb

input:

3000 4499
2264 1470
1757 1093
917 2832
1216 2704
1930 2415
2745 705
643 814
2679 1285
553 1954
2361 1525
803 2423
1148 386
427 1275
1903 2944
2660 505
1832 2046
1313 730
2826 73
2392 1736
2109 2893
1251 2552
1391 1153
2278 744
1938 2881
2359 93
147 2736
1860 952
1972 2555
1866 1399
1603 968
788 728
...

output:

12198

result:

ok single line: '12198'

Test #100:

score: 1
Accepted
time: 9ms
memory: 58464kb

input:

2957 4924
2903 795
1396 672
2614 2444
1491 1216
1824 755
1201 2682
1767 2830
2952 1292
2226 1098
2788 125
2132 2344
970 130
292 1842
1237 437
939 2192
1550 2133
1653 904
1262 1638
264 670
2637 643
2485 1409
1414 2614
94 60
708 715
1647 2733
2199 2024
2309 334
1258 2876
903 2095
955 2175
1890 1231
30...

output:

26236924

result:

ok single line: '26236924'

Test #101:

score: 1
Accepted
time: 15ms
memory: 58704kb

input:

2999 4994
445 967
596 2801
786 1390
86 2812
681 567
1478 1412
2004 2538
1871 2239
1597 799
195 2718
1898 2679
2033 1289
2158 1342
1096 611
2069 606
794 139
248 2748
382 1848
1248 1347
1169 2409
470 637
117 2270
2482 2889
2527 687
1431 1020
2571 1585
1205 194
140 2909
513 2353
1776 1751
1646 1810
209...

output:

25601892

result:

ok single line: '25601892'

Test #102:

score: 1
Accepted
time: 11ms
memory: 58180kb

input:

2999 4994
163 999
544 795
1825 2396
2976 1242
566 1311
1966 1023
1420 2526
2834 2311
1750 2795
612 1912
304 2818
2036 2299
382 323
651 1564
2752 2812
2233 2067
1178 2612
1916 592
2176 1932
2604 1490
2078 2438
59 1586
2654 2737
2457 1946
1183 1542
2553 1246
2557 171
2627 2513
2171 2513
1538 1895
604 ...

output:

25112735

result:

ok single line: '25112735'

Test #103:

score: 1
Accepted
time: 8ms
memory: 58080kb

input:

401 10000
306 4
109 241
319 194
140 229
365 174
91 323
337 347
127 349
52 250
96 324
205 3
34 178
84 186
303 80
235 228
89 382
225 144
391 285
309 391
216 33
283 25
397 222
170 283
23 307
322 237
139 224
321 327
158 294
254 86
310 265
226 219
93 348
279 26
354 133
392 309
331 228
252 188
70 22
251 2...

output:

1

result:

ok single line: '1'

Test #104:

score: 1
Accepted
time: 7ms
memory: 61476kb

input:

3000 4997
2998 2699
2474 1046
1959 2187
2008 1851
2328 2253
826 1635
2999 259
2760 1115
2864 1046
1306 1127
429 1224
861 283
2550 204
564 2179
1075 958
1383 791
2379 510
949 444
796 1459
1952 2696
916 470
1856 2634
946 568
1250 1513
1241 2948
771 2985
610 1509
368 1513
349 79
748 664
2012 594
1600 1...

output:

5138881

result:

ok single line: '5138881'

Subtask #5:

score: 1
Accepted

Test #105:

score: 1
Accepted
time: 164ms
memory: 84196kb

input:

50000 150000
1991 3143
21349 44702
31247 42669
25507 37965
30412 49299
42044 38756
42138 41113
1488 32434
34208 17493
20840 21536
5774 22280
23608 8775
12401 15509
10050 29833
19233 13110
33781 13775
47773 6171
33162 25107
39816 35136
36124 20728
37273 39076
3443 17847
27460 32446
44858 37844
1464 4...

output:

3906142805978

result:

ok single line: '3906142805978'

Test #106:

score: 1
Accepted
time: 162ms
memory: 82752kb

input:

50000 139087
15069 44406
20069 3304
438 43902
11142 31219
47961 16245
37250 16537
11666 30165
43892 26539
8994 32792
29109 11706
13794 49576
8196 37564
40625 14205
41279 8828
13617 6401
33916 22426
6199 48957
34107 31982
32935 19075
32876 3228
32500 49835
30501 5018
35851 14896
46242 40419
47459 184...

output:

5337586368678

result:

ok single line: '5337586368678'

Test #107:

score: 1
Accepted
time: 162ms
memory: 83052kb

input:

50000 136801
48445 5175
46095 40900
17740 18080
37071 35352
13872 7543
14568 12343
38997 8513
14870 12581
14065 29211
13169 22896
24172 36728
7955 41119
48602 7561
16317 29440
46725 6435
23571 33650
41422 11423
16852 7040
32029 27403
28065 22929
46090 30092
1009 36637
32996 17503
32820 21622
49576 6...

output:

5673534350664

result:

ok single line: '5673534350664'

Test #108:

score: 1
Accepted
time: 168ms
memory: 82872kb

input:

50000 149996
34978 12741
9300 38392
25599 18747
24913 41972
27878 42011
23935 39596
15812 24922
38085 15236
37432 39214
37556 5372
34718 34917
21418 14124
30909 46300
4318 18345
40108 20924
9500 6242
29310 41009
6851 25837
45713 49651
14495 12241
8901 37254
35810 14918
26143 16105
31564 49305
5068 3...

output:

1326612563218

result:

ok single line: '1326612563218'

Test #109:

score: 1
Accepted
time: 145ms
memory: 74536kb

input:

50000 75000
31564 20546
15391 46529
3044 10086
33651 43908
13254 3042
4773 35141
43145 31749
13895 10072
47577 19124
45949 37737
39329 7219
8800 48772
26405 17911
43352 6282
24522 14648
9221 38844
9857 4680
48373 24993
44742 10396
40696 3430
40379 27089
6904 8899
4466 40947
24848 39688
4050 49512
37...

output:

74998

result:

ok single line: '74998'

Test #110:

score: 1
Accepted
time: 132ms
memory: 75412kb

input:

50000 75000
44590 19901
17279 35074
18422 43412
24048 15673
5680 9341
17516 20867
47328 23996
44770 8748
21105 13905
42139 42296
14032 8823
43733 41266
41668 46102
336 34677
42174 9181
22569 9241
8879 24505
14102 40225
21919 19364
15375 4227
34318 45537
9572 43578
14288 11899
43402 8818
49840 6677
2...

output:

74998

result:

ok single line: '74998'

Test #111:

score: 1
Accepted
time: 125ms
memory: 77048kb

input:

49999 74997
27026 20851
40074 36258
3771 28966
4328 22805
1357 29919
40021 4042
37564 14553
318 9676
10247 27641
16867 34357
3414 31631
27850 36348
21396 12124
30790 37212
27557 32444
3351 8513
39189 21400
33836 48853
30748 15192
47874 21764
35376 2601
31505 15690
30892 652
13707 1568
30686 14681
44...

output:

374978

result:

ok single line: '374978'

Test #112:

score: 1
Accepted
time: 133ms
memory: 74892kb

input:

50000 75000
41721 42382
43512 5658
48004 35058
22025 34466
39907 3924
2992 38283
36892 29205
49176 14409
19241 3755
47427 10970
25538 48822
25230 33070
18926 3669
18428 45215
5284 47247
18042 49054
43874 48851
38312 39715
32073 36232
7748 1663
23867 47288
15584 43544
47416 7450
27175 2051
35652 1767...

output:

74998

result:

ok single line: '74998'

Test #113:

score: 1
Accepted
time: 126ms
memory: 75680kb

input:

50000 116136
28732 41125
33053 24953
25836 2477
5839 42301
21839 12588
995 24918
49706 1088
37371 1331
23084 34364
17662 47872
43916 28628
30660 41286
34617 31215
35254 199
18152 48098
30532 8664
46344 37627
507 39926
9857 45669
17432 18727
46033 25690
10183 917
42607 24466
21012 10552
10682 27538
3...

output:

41109063897033

result:

ok single line: '41109063897033'

Test #114:

score: 1
Accepted
time: 133ms
memory: 81524kb

input:

50000 150000
4746 48761
15330 43702
970 45454
20125 9815
17035 26442
45750 13752
44883 3731
7172 38723
36370 44778
47251 25186
46276 21292
38403 36996
24944 43640
33095 39930
29668 35684
31381 34413
8351 18221
49724 1262
4466 1983
49450 49268
10152 26529
24631 24844
30583 49003
36281 33151
42394 465...

output:

72500705977658

result:

ok single line: '72500705977658'

Test #115:

score: 1
Accepted
time: 134ms
memory: 81936kb

input:

49999 150000
25247 5113
2454 18247
46963 17305
30910 26503
35644 6284
13533 44002
12437 7593
10945 18667
4042 10131
49053 9382
46214 10815
36059 36797
46098 22512
41313 27035
3675 32327
37983 12716
36057 40100
36865 42336
34544 35468
1133 34682
17363 47003
32005 5061
21212 14754
44800 33327
19050 22...

output:

73915358272556

result:

ok single line: '73915358272556'

Test #116:

score: 1
Accepted
time: 136ms
memory: 75316kb

input:

50000 74999
8840 37038
37088 25558
7226 5259
48952 37678
42363 20776
29436 29150
42269 12400
47059 16813
40494 28591
21937 10987
30377 5774
36825 30646
48915 33908
21192 37791
23544 43617
15924 17046
20862 32525
41065 6782
35813 5730
48361 18279
29406 43238
18846 2735
1369 9001
6957 38593
27812 2265...

output:

203296

result:

ok single line: '203296'

Test #117:

score: 1
Accepted
time: 149ms
memory: 76780kb

input:

50000 74999
40278 25989
33834 23763
6276 5183
3826 24042
4773 14075
10973 43748
25644 32759
19838 26702
9320 40777
37526 36188
28526 31091
8224 28982
8344 30827
4236 31960
2904 20611
17318 24805
4860 2160
25432 15197
14198 7841
35447 21990
27033 7490
29195 32021
20076 23977
26518 11675
29082 35773
4...

output:

200020

result:

ok single line: '200020'

Test #118:

score: 1
Accepted
time: 116ms
memory: 76228kb

input:

49967 83274
33280 13965
16222 37348
15099 19273
45203 26602
49623 38714
44472 6561
7923 47752
12144 33442
1828 33494
31542 9513
17007 23202
29503 48040
39167 4146
24409 29728
37247 41487
9421 2214
24328 42150
46045 27720
2954 43348
21682 9086
15978 33339
11487 13883
18315 22597
28697 18596
18024 128...

output:

7481868066

result:

ok single line: '7481868066'

Test #119:

score: 1
Accepted
time: 125ms
memory: 74916kb

input:

50000 83329
46990 17587
24848 48114
34134 5021
6373 16310
14031 47205
20702 21042
7104 43399
41147 3295
43737 27300
19700 38662
17468 39408
3230 43584
12946 21179
38244 36910
8417 26262
1028 20698
8167 20702
41631 36909
1091 14404
8474 15147
6378 31578
29902 10624
40069 28086
30598 37121
48329 44733...

output:

6969936749

result:

ok single line: '6969936749'

Test #120:

score: 1
Accepted
time: 112ms
memory: 72540kb

input:

1407 150000
162 77
1138 1058
1407 1089
1314 554
952 1336
1000 783
923 740
1257 12
1009 750
790 359
338 330
390 334
1368 311
446 1159
457 995
654 781
16 315
370 485
46 1180
1025 1202
888 757
1373 1350
682 860
157 33
734 1041
836 310
391 1204
441 59
1353 1271
1243 1399
1266 685
171 1395
251 244
581 11...

output:

1

result:

ok single line: '1'

Test #121:

score: 1
Accepted
time: 128ms
memory: 74952kb

input:

3200 150000
1193 882
1353 1938
390 2584
2085 1465
1226 904
1780 410
2555 792
3111 25
2903 147
279 978
1237 1296
954 803
1855 1793
2145 1794
751 2304
635 2366
2878 1920
2356 1744
2458 1037
2617 2683
1159 835
1280 2402
560 2981
546 2989
2179 2323
2022 2560
1003 1991
1370 41
1054 422
823 2666
1240 1643...

output:

399

result:

ok single line: '399'

Test #122:

score: 1
Accepted
time: 83ms
memory: 71892kb

input:

49998 83327
34973 45331
28853 31669
638 46828
19532 28976
30001 1223
35059 44936
29966 33161
25549 43032
14278 35438
48805 7417
26034 49131
33724 48119
4623 11762
20853 24153
42265 37192
23523 18990
39384 32174
25797 20853
38676 8157
684 19598
34913 20853
19362 13948
13594 30001
42497 20859
47401 21...

output:

1395093800

result:

ok single line: '1395093800'

Test #123:

score: 1
Accepted
time: 68ms
memory: 68696kb

input:

49925 74608
15795 40102
15108 20598
22208 19200
47934 18960
14756 31304
6362 46066
35319 22745
3467 37582
45066 42305
36235 21852
24512 34912
23896 35044
529 31776
27793 14507
39876 6686
44936 39060
29069 43028
42926 20856
43148 6857
19002 33952
9321 48624
31599 32128
3120 20389
25378 47031
34964 54...

output:

25499424788602

result:

ok single line: '25499424788602'

Test #124:

score: 1
Accepted
time: 67ms
memory: 67844kb

input:

49680 73836
31323 36932
43621 19160
48695 16247
38403 28436
23264 38355
14418 2217
19675 11399
32676 5307
18002 22485
199 22398
18662 23042
45923 40611
37386 29855
39193 18249
41478 18400
33188 39919
25453 42083
19610 14438
6418 543
7166 31282
48701 36752
5944 48179
1157 45888
39554 15810
25800 3566...

output:

25885832435891

result:

ok single line: '25885832435891'

Test #125:

score: 1
Accepted
time: 54ms
memory: 69816kb

input:

49992 80340
38004 28592
40569 21573
3061 20523
41455 16124
38976 46190
19701 8616
9492 5102
10440 14172
6886 38765
1796 16375
18883 34590
20961 195
2452 37538
11134 26906
45143 24999
34109 1058
23225 14876
45174 36494
29408 41289
846 2358
31001 22680
46808 21280
27889 2487
35735 47626
30324 27638
36...

output:

33813814545029

result:

ok single line: '33813814545029'

Test #126:

score: 1
Accepted
time: 62ms
memory: 70904kb

input:

49998 84336
49718 36057
27819 26511
47973 920
31012 49660
46815 33851
7029 47359
10551 46449
49984 1185
9832 19786
39652 43489
35481 48914
42038 6841
4182 37032
22945 2631
48452 24988
23654 16837
31228 12651
23605 46075
48174 6616
18096 5362
24457 49544
28762 8480
4635 21310
36876 28715
10139 45238
...

output:

24632392303812

result:

ok single line: '24632392303812'

Subtask #6:

score: 1
Accepted

Test #127:

score: 1
Accepted
time: 166ms
memory: 81172kb

input:

50000 150000
14654 26345
16262 18307
45564 2940
34025 14154
7547 38896
20114 3366
31149 45513
28695 13798
6986 30707
22590 34358
5291 48712
22936 4381
32033 28140
39625 3256
42953 35299
11588 48847
30809 15894
29064 20863
13324 24272
36616 19852
34373 35937
22995 47785
48427 34086
33652 32646
13204 ...

output:

3704557253617

result:

ok single line: '3704557253617'

Test #128:

score: 1
Accepted
time: 170ms
memory: 82004kb

input:

50000 150000
8176 122
33204 8001
28787 4955
17829 15921
42956 27417
15188 7142
10348 4895
46252 4823
20752 44428
22508 12953
7872 41773
39172 18177
42190 8046
41247 31936
27160 33756
43764 1524
4170 19783
7886 8269
29662 41453
47469 25355
9865 10830
27939 36023
13681 18066
8432 43189
41529 21867
194...

output:

4387508501166

result:

ok single line: '4387508501166'

Test #129:

score: 1
Accepted
time: 170ms
memory: 80844kb

input:

49996 149997
16197 26113
17889 16823
38311 25444
1266 46808
46515 27227
17202 45630
40653 39518
31688 49072
43212 41130
13078 22629
28728 16668
37932 15815
36713 32255
9373 10351
16438 43598
28342 39345
26609 48957
25726 19002
33428 19517
25551 13500
49967 29924
15464 25770
36405 47805
9946 2609
362...

output:

3917188658153

result:

ok single line: '3917188658153'

Test #130:

score: 1
Accepted
time: 160ms
memory: 82764kb

input:

50000 150000
820 26518
6392 7592
1408 2694
46048 39497
23136 12793
35575 9268
20955 22571
921 5648
33260 29599
34996 31308
19576 6966
45180 9815
49833 12550
44313 21539
27196 27506
15940 3719
27849 9992
24951 34290
29382 13513
32407 38957
25422 48328
40887 7896
26641 25527
14121 12219
20956 7827
100...

output:

1052930187

result:

ok single line: '1052930187'

Test #131:

score: 1
Accepted
time: 139ms
memory: 75372kb

input:

50000 75000
37474 3219
19546 41587
28530 36790
223 43201
45158 10420
47729 1898
39384 7632
38653 1830
44391 9054
45500 42269
25031 28978
27631 29554
29060 19917
17575 25547
1867 27432
11153 21723
19522 30800
25643 27768
2536 15048
38796 14372
44462 13798
8236 975
24276 36999
42411 19933
18355 605
14...

output:

74998

result:

ok single line: '74998'

Test #132:

score: 1
Accepted
time: 138ms
memory: 73548kb

input:

49999 74997
9226 20547
6817 2970
42247 47055
11411 8478
20815 10839
1875 48445
27612 44761
37942 49607
17926 4716
19066 6840
2192 15016
11389 28610
33677 31989
48889 27139
38284 9331
3198 30256
2200 47842
44825 25888
46484 15432
49265 4048
45322 20514
18448 48202
36590 5875
15368 2677
24638 30194
46...

output:

1425113

result:

ok single line: '1425113'

Test #133:

score: 1
Accepted
time: 132ms
memory: 74132kb

input:

49999 74997
30208 31870
28778 46599
8682 45458
4732 12893
12801 38742
24002 16509
44276 39502
49684 47740
41628 2381
546 5269
10937 27607
46911 7547
7230 39492
25149 41104
19713 14919
19069 47968
2646 39619
2503 28629
1199 18588
4477 7306
31647 13635
32756 35162
21630 7320
41567 37315
22788 36602
45...

output:

674967

result:

ok single line: '674967'

Test #134:

score: 1
Accepted
time: 83ms
memory: 72260kb

input:

50000 83327
44586 10660
994 1453
37356 21143
14790 11302
25171 24538
26264 20076
20489 22662
22893 37074
6305 6176
34850 30976
48976 37213
33358 3692
36179 937
11170 39595
40181 28274
3062 1305
21570 49757
24079 17714
38805 8225
27719 16892
20869 26677
21860 2555
23839 44536
32483 41106
13188 45880
...

output:

32653211434079

result:

ok single line: '32653211434079'

Test #135:

score: 1
Accepted
time: 159ms
memory: 81380kb

input:

50000 148249
1323 8769
14051 33509
30788 23667
46381 3379
4622 43671
29949 11009
4663 40688
20121 23007
32776 47461
6829 37901
32754 23097
28027 45761
38637 21931
11331 4800
44018 43930
36811 34262
7425 24825
18644 48446
45156 29503
41067 1811
44881 57
5064 49598
12780 3300
11574 4101
15461 11148
45...

output:

48532817132773

result:

ok single line: '48532817132773'

Test #136:

score: 1
Accepted
time: 138ms
memory: 81908kb

input:

49996 150000
31230 45590
18150 48995
5049 40146
33040 48157
4892 3156
39486 48115
3005 49445
1035 36971
13033 44483
42551 5802
42461 24257
47788 6196
22680 18845
19259 21190
45028 40000
20881 23551
45452 18369
7002 47601
29503 16738
46328 4203
39849 49080
46655 27246
10033 48801
32163 30599
21190 86...

output:

72223583264988

result:

ok single line: '72223583264988'

Test #137:

score: 1
Accepted
time: 127ms
memory: 75624kb

input:

50000 74999
49523 3027
13563 19531
11718 42128
47675 30367
18381 10431
18661 33274
18700 1847
19756 12230
14605 32353
36056 33979
3666 8091
1983 28377
37843 12369
36246 41218
8873 47430
23924 5969
40676 28677
40381 10710
12212 31715
33940 47020
6531 46689
8391 6679
47789 37384
33716 39626
26090 8977...

output:

224993

result:

ok single line: '224993'

Test #138:

score: 1
Accepted
time: 136ms
memory: 76356kb

input:

50000 74999
47892 29873
19066 31365
8246 43368
8295 25013
13988 14208
7938 35715
31135 47223
15380 26200
7582 45544
27517 13754
43844 8810
20150 37544
656 12251
17500 37908
41350 45811
30273 819
39914 28088
37471 45862
6015 30927
48122 29856
43649 19800
24859 27884
20049 24204
44726 31340
20800 2338...

output:

200567

result:

ok single line: '200567'

Test #139:

score: 1
Accepted
time: 93ms
memory: 72428kb

input:

50000 83329
10894 49879
41529 16471
40825 38811
6390 31357
33933 28242
7243 20310
7546 1965
12174 17648
41898 8261
17571 6679
24161 6177
42213 2619
10147 33219
45878 22314
40984 25504
15019 27512
33154 46110
11807 11571
37002 28370
24515 22349
28489 7963
28415 41191
45301 37360
39471 24894
31694 423...

output:

8330816919

result:

ok single line: '8330816919'

Test #140:

score: 1
Accepted
time: 120ms
memory: 75128kb

input:

50000 83329
39386 43823
47200 1813
43201 45404
21719 11314
28906 22600
4597 15939
16142 7863
30372 33604
24106 4230
27524 179
48013 24356
34786 44694
35491 39505
32460 27801
42469 39713
25161 19599
13936 15631
16977 19501
20656 1958
24973 42543
19777 10924
3806 3623
36701 4182
7890 33791
33099 2954
...

output:

7120090996

result:

ok single line: '7120090996'

Test #141:

score: 1
Accepted
time: 121ms
memory: 77424kb

input:

50000 83329
24923 27688
49056 41846
4182 10539
8183 29118
2130 7729
18796 47712
43080 30456
24823 21314
8178 28638
6924 6428
1936 9210
44422 29521
44424 265
12672 6904
21949 41996
1024 46521
34255 33852
9798 38089
28136 15358
24204 33442
31997 27576
35141 15883
4620 25827
38886 6007
31757 1203
31030...

output:

6946272027

result:

ok single line: '6946272027'

Test #142:

score: 1
Accepted
time: 145ms
memory: 73208kb

input:

15000 150000
11692 5418
5884 5306
6439 10764
1429 9409
11574 3652
11324 14081
3207 14482
6433 740
2045 6602
9142 7278
3784 11589
1961 4520
11902 11483
1401 6945
10170 5023
4876 99
4587 5711
11817 10923
14706 6332
6939 14436
8102 13052
13851 12410
6811 3146
4454 2490
8650 10520
9146 13597
2109 3413
8...

output:

299

result:

ok single line: '299'

Test #143:

score: 1
Accepted
time: 185ms
memory: 83884kb

input:

50000 150000
32883 16693
15652 14447
1976 22014
1629 23824
23870 32190
6448 12261
24605 12053
29295 26901
33242 29772
49850 44832
27962 34286
9605 665
36031 536
2144 6523
21358 7546
28951 2859
43664 23109
1468 49701
14840 47028
12281 22437
36868 45653
16989 30324
8799 29462
9969 46235
49206 45877
17...

output:

4107674035365

result:

ok single line: '4107674035365'

Test #144:

score: 1
Accepted
time: 63ms
memory: 69352kb

input:

49921 74395
20161 9388
5452 18758
46453 27563
18369 34695
20989 35159
38974 31525
21264 6346
5867 38240
14893 27528
24805 39932
7237 2766
39162 34882
1748 19341
42572 4948
27737 6959
7272 2820
48751 30386
33457 35094
25660 37740
39938 31650
25037 48820
45906 5544
47392 45199
47425 9540
36250 27770
1...

output:

26248811227352

result:

ok single line: '26248811227352'

Test #145:

score: 1
Accepted
time: 62ms
memory: 68444kb

input:

49937 73421
42620 14835
1280 47658
45665 18705
47440 18251
8243 49691
29694 9137
40063 39745
16496 6078
6126 16692
14050 19379
16845 21357
45795 20470
18236 36814
24838 5233
15092 24264
8266 18511
38860 1051
1589 26354
11418 3663
35994 13013
45860 5555
30989 45534
18627 6677
22163 33211
33276 38316
...

output:

26063901762248

result:

ok single line: '26063901762248'

Test #146:

score: 1
Accepted
time: 69ms
memory: 68292kb

input:

49767 73693
12227 10500
12554 16912
43676 23790
21797 22805
23164 3554
25158 18908
49421 24374
14566 18995
18055 9034
39965 39612
1150 24026
3704 15669
17499 32509
4613 41413
46436 20753
6493 11316
47076 42398
2867 2253
29205 40680
11666 44992
36254 47544
45659 16583
11623 31986
37893 42952
48716 12...

output:

26271707780297

result:

ok single line: '26271707780297'

Test #147:

score: 1
Accepted
time: 48ms
memory: 68536kb

input:

49994 77563
27704 22855
3435 13975
27984 39195
45999 46690
42733 268
36653 18466
3292 8528
7429 15591
18069 7663
26049 23599
34597 11858
6541 35286
425 23434
24182 39993
40005 14305
33065 16313
1183 43475
46953 31146
13191 16418
10680 5708
44776 36251
46663 33464
15994 20100
22451 31656
36628 31385
...

output:

39095447980553

result:

ok single line: '39095447980553'

Subtask #7:

score: 1
Accepted

Test #148:

score: 1
Accepted
time: 399ms
memory: 109036kb

input:

100000 299995
76541 36034
21821 10717
92372 13436
91177 67290
71556 36287
43424 89680
17336 89543
63537 88070
82867 44178
92429 69404
13146 91748
23872 72000
37854 97944
23163 54817
59266 1546
15026 23692
50066 78011
52457 48543
11443 92637
75907 78168
27266 11744
82645 78843
6877 87925
11409 71750
...

output:

32232518751544

result:

ok single line: '32232518751544'

Test #149:

score: 1
Accepted
time: 360ms
memory: 106024kb

input:

100000 276447
16983 6403
74141 60430
39653 4186
56589 64763
68560 5048
13864 73183
67327 72443
54075 61110
77440 79003
20697 69250
1908 35751
65382 93295
18421 58991
97411 38990
9799 82772
24872 28764
35625 9372
4550 99105
61069 77218
50618 91208
98024 34191
19728 78358
92443 43372
97802 61577
89732...

output:

43572298312307

result:

ok single line: '43572298312307'

Test #150:

score: 1
Accepted
time: 408ms
memory: 106012kb

input:

100000 300000
82000 29381
80370 75500
8914 94087
32555 63646
11770 10772
9956 73439
83305 96002
40878 24028
40775 76896
69979 18967
31069 5353
28305 78970
35543 4799
10817 32572
94873 51304
2435 91127
72609 14197
31604 99019
85350 95583
78113 3384
92640 7913
78437 4296
23612 52166
84001 24674
4296 4...

output:

34203841351835

result:

ok single line: '34203841351835'

Test #151:

score: 1
Accepted
time: 366ms
memory: 104464kb

input:

100000 300000
39714 57728
14616 77302
68663 70985
85153 83292
4845 86664
30727 59101
10203 64391
64428 93942
57368 76244
44341 34525
14407 93054
5022 35558
32101 87032
8862 72878
16291 91443
29744 67583
27860 6039
15313 54459
93127 68662
34430 69143
86300 49412
87395 14900
81254 46117
51058 54167
82...

output:

10253127352593

result:

ok single line: '10253127352593'

Test #152:

score: 1
Accepted
time: 327ms
memory: 90952kb

input:

100000 150000
36129 11900
75681 95463
77063 28509
30170 76845
80274 5238
92077 94876
30539 83164
79236 75436
89898 7187
88973 59049
23996 51223
21442 39765
27549 878
28183 57361
96393 92137
2026 70750
65864 8978
49663 48041
97570 75497
63034 48675
50491 52513
65102 45470
52118 10542
81314 19122
6146...

output:

149998

result:

ok single line: '149998'

Test #153:

score: 1
Accepted
time: 294ms
memory: 89324kb

input:

100000 150000
43007 57766
37419 30941
83769 71926
61713 44270
31582 81855
94810 59877
2338 58631
73050 64208
82748 8921
72558 17918
25139 85744
90005 23477
55622 7685
64904 71865
21059 57744
84975 27380
80903 74730
34402 56793
74483 4759
48949 22858
39352 5175
60166 9967
16764 40079
82374 96049
5975...

output:

149998

result:

ok single line: '149998'

Test #154:

score: 1
Accepted
time: 300ms
memory: 92964kb

input:

99999 149997
75903 32259
89499 8285
4061 28770
75147 90177
8838 48701
51703 58002
75720 44559
4037 48131
93970 94625
53333 10338
3298 16119
29080 48207
37152 78813
78606 32874
46322 15829
96380 94230
73489 84967
16865 85220
39207 48703
9760 95734
67822 8736
49563 93583
67270 7009
35302 1236
42271 87...

output:

749980

result:

ok single line: '749980'

Test #155:

score: 1
Accepted
time: 316ms
memory: 88608kb

input:

100000 150000
93736 67775
78877 42312
19584 12907
50210 62744
56488 80454
72658 74891
90844 58346
41149 7965
78410 19149
9870 95174
92071 94726
37494 83236
81259 10986
40021 53667
65137 47043
28580 40726
32926 50143
43971 13234
50139 59940
35560 53125
86098 55885
94585 12774
53936 89218
38783 90275
...

output:

149998

result:

ok single line: '149998'

Test #156:

score: 1
Accepted
time: 263ms
memory: 92684kb

input:

100000 226269
71269 2411
31898 87484
45676 46410
19608 46474
26131 33237
16958 74652
55211 13625
55238 32532
66147 1840
23335 1347
42633 86466
41582 97130
18375 30669
44552 13828
68017 3645
26229 65684
21575 4419
8856 95994
59651 5762
45588 58895
90938 7540
76965 52180
56696 42633
35370 75680
53358 ...

output:

353394876793665

result:

ok single line: '353394876793665'

Test #157:

score: 1
Accepted
time: 292ms
memory: 102668kb

input:

100000 300000
66183 28095
86174 69916
79407 14479
40281 30678
5881 61605
87351 73951
54084 15286
25109 74381
24102 6030
59740 29248
68850 62186
81688 47379
897 68589
51847 93055
26486 15342
94901 27341
46945 50226
56911 85552
97668 63957
1431 42437
24236 77775
56015 53787
40815 85993
61472 22289
8 6...

output:

585581184277890

result:

ok single line: '585581184277890'

Test #158:

score: 1
Accepted
time: 295ms
memory: 102400kb

input:

100000 300000
95475 60422
42918 93690
53206 73884
43341 70252
47861 83263
92684 55256
86892 11304
96291 10674
66046 6069
65349 66170
46196 96606
10456 13130
30580 9726
37422 79243
95956 2105
60630 52199
88614 98462
49520 70958
60647 21339
64062 35403
51163 68499
60018 30898
11476 38081
95053 74996
8...

output:

571910459655595

result:

ok single line: '571910459655595'

Test #159:

score: 1
Accepted
time: 299ms
memory: 93524kb

input:

100000 149999
21753 36057
55714 66929
71718 85196
24523 77916
12076 28035
88444 61467
17269 83632
12546 22246
38302 7399
98339 90151
47658 22208
30420 66094
14487 86784
43442 57182
25231 14733
31638 99421
45317 31568
80760 52028
64377 1960
16292 8712
93637 31085
43745 64708
54633 11392
49815 41807
6...

output:

406696

result:

ok single line: '406696'

Test #160:

score: 1
Accepted
time: 317ms
memory: 91612kb

input:

100000 149999
96279 66999
50388 91216
99849 11093
84348 58739
71477 35812
15605 50264
7139 37370
16020 1894
81540 89565
81776 61662
17917 27712
14918 67679
24097 18374
68065 13358
28664 30140
5810 55919
82365 82963
14165 46186
7398 50523
21304 42570
67467 73951
93242 32280
17176 17702
54234 63740
40...

output:

400045

result:

ok single line: '400045'

Test #161:

score: 1
Accepted
time: 250ms
memory: 91680kb

input:

99959 166594
33956 66392
74581 8956
34932 81383
48063 76911
50394 7883
84902 79568
74120 54867
6170 88265
46925 55484
49997 84213
4545 27520
63819 61164
36139 66865
99516 14617
48289 97221
77897 33161
10355 83610
27637 93161
11873 72575
47631 41214
76083 743
75134 44770
62400 80863
87336 18841
96319...

output:

29977321454

result:

ok single line: '29977321454'

Test #162:

score: 1
Accepted
time: 303ms
memory: 95116kb

input:

99998 166659
37325 37745
52366 70977
99422 12153
9515 89336
71905 2863
52600 95055
93736 21466
93860 6322
24827 29444
32820 70261
4469 4298
58065 49887
62851 52106
70891 79683
3417 69056
10062 49408
82601 973
93929 95508
93262 84553
10698 24881
26503 31928
6938 30786
41454 22215
1289 10573
69514 898...

output:

27883982300

result:

ok single line: '27883982300'

Test #163:

score: 1
Accepted
time: 237ms
memory: 88256kb

input:

2007 300000
150 1167
976 2006
1740 1743
1804 854
574 1017
996 1410
480 510
501 1111
348 1216
1558 233
294 825
1638 980
262 337
1239 1781
1618 1428
294 618
1960 806
1328 364
1771 1313
874 539
33 6
1378 994
1818 1494
951 1933
623 1863
969 344
930 1664
753 1165
1077 1366
570 983
1666 250
1382 1025
239 ...

output:

1

result:

ok single line: '1'

Test #164:

score: 1
Accepted
time: 271ms
memory: 90516kb

input:

15000 300000
13435 11311
3635 12023
2387 10642
10057 7653
4024 14995
14870 4947
12672 7779
1532 569
12991 9067
4844 9633
10807 13587
2293 10039
3256 9120
14545 1472
5305 8984
6407 725
10497 4002
3675 9615
11513 4686
14995 7525
6809 13987
12760 34
10254 7598
6791 1208
12912 5702
13213 13721
14913 112...

output:

49

result:

ok single line: '49'

Test #165:

score: 1
Accepted
time: 196ms
memory: 84624kb

input:

99999 166662
20205 55681
16825 19024
63198 60556
15467 5081
55828 70191
98977 90645
11939 14912
90645 75630
22757 90264
97118 5327
29441 78183
60747 31164
43185 25112
89661 90645
86724 84149
83592 92212
53419 14098
29873 95986
99843 95986
4338 90264
51165 61176
38242 12894
23441 96106
167 85232
5401...

output:

5570243931

result:

ok single line: '5570243931'

Test #166:

score: 1
Accepted
time: 149ms
memory: 77472kb

input:

99930 149919
45367 1275
30064 27270
66331 62315
61700 56060
83240 87034
73482 91528
96871 86709
89319 24523
59232 84371
97259 99762
80890 30434
98501 93638
86128 92400
95450 76013
86566 30488
33792 20071
2499 74755
68708 14560
54297 95590
8504 70296
62104 42855
37930 90089
70797 19128
81263 75846
57...

output:

204169036833248

result:

ok single line: '204169036833248'

Test #167:

score: 1
Accepted
time: 140ms
memory: 79572kb

input:

99766 148375
9174 81111
27933 91648
79815 29560
49939 19023
63267 23708
96842 83332
98089 11739
34473 43030
12380 19172
5117 7074
46921 20832
38347 61412
72366 20475
35320 60572
24389 50506
64980 66715
17768 62692
89202 7567
67314 59932
29138 88027
48122 40306
61428 92065
26210 40857
63454 92653
964...

output:

210163547178875

result:

ok single line: '210163547178875'

Test #168:

score: 1
Accepted
time: 124ms
memory: 79164kb

input:

99992 161268
92412 93769
82049 70349
69588 62900
73311 41611
63443 8752
15402 72794
35821 41873
91948 8875
14678 1243
64818 13949
917 40111
50912 83436
8956 60543
54369 60951
61431 27505
50862 91400
69241 25182
7853 70201
40801 31794
16213 99661
52396 11106
28046 78640
89288 26731
51540 57030
43559 ...

output:

269393296787107

result:

ok single line: '269393296787107'

Test #169:

score: 1
Accepted
time: 137ms
memory: 81196kb

input:

99994 168625
46008 7326
92567 68779
14369 66832
73457 96612
38416 30534
81252 35297
76845 92643
34873 96918
25685 58981
68615 13031
34189 94479
14532 8036
79711 75393
59530 10618
823 54896
21555 29643
39006 68701
83637 19964
39827 29915
85218 48035
94867 86260
6195 12537
61413 97076
82609 39821
3491...

output:

193147550004395

result:

ok single line: '193147550004395'

Subtask #8:

score: 1
Accepted

Test #170:

score: 1
Accepted
time: 371ms
memory: 104572kb

input:

100000 279113
79936 98761
86614 13502
60129 57171
2595 59656
26815 73006
73210 93780
40617 228
10831 3236
55162 74636
9755 51956
77084 72230
67416 15170
70010 48350
89472 13476
82658 83842
52979 65242
76367 98517
83573 36155
54122 47171
3609 48304
49848 33193
50856 12549
66484 23383
10297 46286
5170...

output:

45963547774669

result:

ok single line: '45963547774669'

Test #171:

score: 1
Accepted
time: 412ms
memory: 107824kb

input:

100000 300000
87730 67067
51851 37913
25147 5968
45707 73702
2073 44094
97720 78298
62278 95471
48132 83607
66539 57662
74478 60999
84608 41341
34082 29596
364 62916
15425 13585
61204 32530
69763 10334
27822 43236
48483 30294
94043 65754
70183 1088
4007 39913
37843 7663
86896 81860
71202 84718
52234...

output:

34651566895671

result:

ok single line: '34651566895671'

Test #172:

score: 1
Accepted
time: 396ms
memory: 107744kb

input:

100000 300000
10869 62961
99655 31875
45526 13058
72426 32943
42328 6203
60434 66730
42013 24792
79795 80924
24934 90409
4398 91845
65878 15901
77325 88031
65414 21025
57486 57104
72357 76273
37601 57659
72060 10856
78608 13984
60493 86703
53018 2474
16158 25275
5848 99114
51011 87538
91051 76504
64...

output:

34159051860729

result:

ok single line: '34159051860729'

Test #173:

score: 1
Accepted
time: 374ms
memory: 106120kb

input:

100000 300000
54019 98198
34078 21644
13056 15406
21002 9068
11379 16487
69273 28192
33304 53102
71498 29122
88108 13720
95837 6484
21868 27603
89430 65312
36499 38823
95737 68261
48613 84891
90801 40512
46111 82007
46504 66059
26202 21663
34939 18005
743 19314
70212 9695
4397 30706
97382 76144
4683...

output:

9095102340

result:

ok single line: '9095102340'

Test #174:

score: 1
Accepted
time: 285ms
memory: 92536kb

input:

100000 150000
41912 44697
48906 50902
42452 44445
71930 41121
31172 60598
65637 33406
33257 45287
85661 65969
50395 67443
60144 23058
64921 62468
51544 65832
24639 97309
18756 20315
22695 10694
53680 10718
48876 9891
50263 496
14584 30514
20990 41113
55964 10313
60121 69807
42057 84752
56866 52563
3...

output:

149998

result:

ok single line: '149998'

Test #175:

score: 1
Accepted
time: 330ms
memory: 91128kb

input:

99999 149997
63685 82066
11965 13738
9720 68229
21479 66156
14927 36110
20831 69254
76433 12862
11988 81641
31245 25054
50723 2407
54197 61604
55929 19752
23072 82159
64738 75861
17059 90232
37469 88531
98473 10290
89431 42857
44636 26375
99465 97500
17355 69660
85303 63356
82599 85729
18915 3267
71...

output:

3300128

result:

ok single line: '3300128'

Test #176:

score: 1
Accepted
time: 306ms
memory: 88816kb

input:

99999 149997
83945 96160
84148 97689
8263 28513
67065 51661
95829 87959
51779 33735
91867 76600
49928 77905
81881 98788
89075 73336
44324 97732
6509 93275
83842 65232
61604 46519
58274 71127
75287 32929
35238 71770
31004 49498
78129 57843
85106 67293
96252 94336
37579 99136
90981 83063
43607 71394
4...

output:

1199976

result:

ok single line: '1199976'

Test #177:

score: 1
Accepted
time: 173ms
memory: 80688kb

input:

99998 166653
86911 52438
88976 63209
21977 72305
84793 69829
60777 67720
57966 49100
6115 14422
26465 24671
69270 6063
93874 90647
1928 14983
79255 78535
14446 16620
47904 47565
6515 90536
56631 56896
94842 72230
27642 41786
45546 65106
58135 27677
52713 73859
89746 9672
91653 93458
68927 2173
33345...

output:

266471811089822

result:

ok single line: '266471811089822'

Test #178:

score: 1
Accepted
time: 380ms
memory: 106012kb

input:

100000 299418
90874 79395
38088 90843
83328 65305
98394 35093
83253 13362
7191 7799
91059 22299
6158 20691
10336 82811
97807 34475
19850 20575
52270 7456
18485 22681
62380 10582
75816 35412
12129 12441
82717 44638
23919 65900
78972 39325
59539 51371
70449 34220
69659 76732
24235 96137
2743 6296
3986...

output:

373943961527462

result:

ok single line: '373943961527462'

Test #179:

score: 1
Accepted
time: 306ms
memory: 102648kb

input:

100000 300000
31620 12797
31479 52025
6133 77878
14516 75795
61089 89631
25719 76149
22999 11268
86219 9119
39288 89609
99322 38622
20764 69538
85682 98516
21686 60914
59048 57059
18272 32613
79541 80380
69006 13302
37538 53041
64288 97844
20203 44106
10015 89916
73381 83105
11729 17559
21586 37636
...

output:

577128001519197

result:

ok single line: '577128001519197'

Test #180:

score: 1
Accepted
time: 296ms
memory: 94564kb

input:

100000 149999
20030 64358
46795 83103
88857 29816
64952 16078
79668 93588
30843 48369
5612 84851
77868 9051
44852 55357
33849 8423
64655 48277
90421 80471
30127 486
52558 90476
93848 56852
43544 61055
60360 68323
5600 47815
11200 70424
84846 83167
98444 72731
76605 40863
43026 60071
28930 68479
6875...

output:

449993

result:

ok single line: '449993'

Test #181:

score: 1
Accepted
time: 309ms
memory: 93544kb

input:

100000 149999
70483 4500
23638 64629
3645 52843
44570 5243
86835 14052
15949 18084
75396 73619
45254 45140
76011 96134
20670 18332
97252 32623
14954 35819
3301 14292
18969 87371
69247 12191
52578 7208
30701 18639
18127 60573
57155 61866
72199 89433
62166 98814
28064 31708
17344 43521
52196 88204
530...

output:

401114

result:

ok single line: '401114'

Test #182:

score: 1
Accepted
time: 199ms
memory: 85216kb

input:

99998 166659
74296 71813
17334 45084
51918 9352
5971 74474
4748 96195
29121 58491
72098 63722
8537 30279
32715 68590
13474 83292
77290 42113
44857 26193
38000 36025
3179 96211
69966 54228
20657 48785
85422 29833
83176 52553
47738 84428
4416 42393
4883 24800
65137 53540
61527 13731
46385 12215
35025 ...

output:

33371297544

result:

ok single line: '33371297544'

Test #183:

score: 1
Accepted
time: 280ms
memory: 92076kb

input:

99998 166659
86017 60841
59120 51040
43900 99498
47377 3412
93406 39708
91142 79587
64425 66030
95776 17931
22951 20367
60976 21872
11474 93629
84728 81517
20527 94058
99241 37484
82753 1991
81373 34462
57429 41711
70872 89194
72162 7023
53149 61508
95185 56339
88339 64764
42133 24545
69822 32426
96...

output:

28514276881

result:

ok single line: '28514276881'

Test #184:

score: 1
Accepted
time: 286ms
memory: 89488kb

input:

99977 166624
69537 65741
12626 44349
31166 38379
74113 71736
66204 79448
17247 96395
35055 37181
73046 29979
81862 60797
12352 42220
80317 34047
52047 90132
89002 19943
79420 71164
46622 69262
91141 69479
35224 72102
94149 87870
7553 80639
92210 75589
71624 18253
84050 52956
35826 33239
28117 67271
...

output:

27776987064

result:

ok single line: '27776987064'

Test #185:

score: 1
Accepted
time: 258ms
memory: 89264kb

input:

6000 300000
2026 2783
4265 3869
4003 3510
5533 866
5671 1791
35 292
4786 5728
1161 253
3706 2871
791 2140
632 86
777 3412
1065 4735
4690 2270
2585 1103
54 3867
1286 2928
5209 5590
4006 1933
4955 2933
4657 16
5957 1156
167 4121
3411 1036
5691 4038
3013 5249
2458 4978
5597 5061
248 5750
1473 2605
4499...

output:

99

result:

ok single line: '99'

Test #186:

score: 1
Accepted
time: 400ms
memory: 106564kb

input:

100000 300000
35473 5815
84043 72477
11492 9547
72860 40962
42181 9364
56019 47375
13611 44211
76172 16317
33915 33284
9593 92721
82426 49024
49947 78804
82552 46073
2743 59662
87313 67555
65633 63030
25716 39370
63171 93822
13182 68776
32169 45092
16678 3932
18763 52367
27621 44766
72667 89930
3153...

output:

36218220007615

result:

ok single line: '36218220007615'

Test #187:

score: 1
Accepted
time: 135ms
memory: 77344kb

input:

99964 148197
49813 27424
27027 44466
59045 76414
91160 58613
62288 16663
70728 54789
20190 97064
83512 93260
48634 27762
17086 99213
61311 19496
51836 60293
12281 61687
5856 55836
27239 64321
54109 79487
77801 68123
83169 69146
71506 11459
11614 41930
27711 19843
68841 52200
68534 16747
4845 32920
5...

output:

209576010445225

result:

ok single line: '209576010445225'

Test #188:

score: 1
Accepted
time: 132ms
memory: 78284kb

input:

99929 146648
28092 62970
66523 57120
69091 86816
50887 8597
64176 80863
29713 39029
97256 70820
15827 84663
92720 45160
26826 35008
46951 70633
12983 29310
14218 12470
49238 48691
7447 32561
58705 67305
6367 86706
6269 38133
80472 73204
77632 78534
29282 95248
47070 37430
88641 58648
56923 22526
261...

output:

210094525749519

result:

ok single line: '210094525749519'

Test #189:

score: 1
Accepted
time: 157ms
memory: 78504kb

input:

99669 147867
24819 39500
91142 15268
15148 94982
30148 27592
69280 79304
35237 42382
53627 98844
10904 62014
27660 65134
19071 14744
47914 36849
16707 72579
22852 1742
31158 21052
46808 63945
2982 44304
90876 1221
33483 15080
43057 60953
10801 66423
52375 11287
92801 60734
41743 4630
62585 28781
579...

output:

211351226434263

result:

ok single line: '211351226434263'

Test #190:

score: 1
Accepted
time: 110ms
memory: 75972kb

input:

99995 155274
8437 70531
81469 33058
22472 97622
73229 36459
55070 82483
82261 77979
75249 20672
74245 68379
2527 97298
31662 63335
26044 56750
7197 30361
20100 70121
80935 25638
79486 1690
16243 86021
68874 8178
76834 27093
63611 77287
96004 53026
20367 91828
36083 97425
56434 64140
32501 82680
4491...

output:

311413061150765

result:

ok single line: '311413061150765'

Subtask #9:

score: 1
Accepted

Test #191:

score: 1
Accepted
time: 792ms
memory: 147664kb

input:

200000 499996
14624 5312
87648 67591
23942 139952
90144 149693
72944 191585
172981 110212
70462 12669
60888 174228
45855 161004
187502 20151
13037 10778
108403 70474
60659 59857
101373 2903
25797 181839
178092 4148
47398 58716
33458 86598
122142 109187
84168 97778
129458 9734
155530 196813
74051 160...

output:

513716366636593

result:

ok single line: '513716366636593'

Test #192:

score: 1
Accepted
time: 847ms
memory: 146500kb

input:

200000 500000
196141 127446
170569 6110
48544 164416
187935 115549
128222 138489
66852 67723
70416 152631
21176 156784
179618 81139
43896 78852
146902 5191
129476 10916
109068 196458
84485 124704
68993 150118
51204 93498
164414 93061
47582 118341
62968 11133
120037 87590
9518 85428
194523 102781
164...

output:

520239427759344

result:

ok single line: '520239427759344'

Test #193:

score: 1
Accepted
time: 651ms
memory: 128084kb

input:

200000 422783
117819 69914
158560 94346
20877 28506
57092 34772
106317 135378
115553 31365
30090 6430
133826 138956
182824 28367
151895 135231
753 148001
49011 116169
175138 108496
27208 118001
46383 194359
61013 164921
22706 137468
53990 100953
108583 121282
69256 155524
73331 99942
53679 163164
18...

output:

782224432387507

result:

ok single line: '782224432387507'

Test #194:

score: 1
Accepted
time: 750ms
memory: 137232kb

input:

200000 499997
139911 137901
64540 46041
88506 186886
10206 91681
106997 177232
142173 150506
73002 10732
81884 193827
77038 170016
174161 62702
28255 192386
15478 158067
24554 12328
176268 11725
151053 21088
196048 4736
193452 54105
188837 82730
108430 41012
116021 31537
26041 42005
88508 182272
725...

output:

131229390915888

result:

ok single line: '131229390915888'

Test #195:

score: 1
Accepted
time: 791ms
memory: 122172kb

input:

200000 300000
198740 42125
17592 91943
132595 43769
48213 55581
171731 17616
100364 120333
156122 153406
108469 4676
93559 113795
74068 181367
178176 177233
189564 153820
25850 142735
151357 55392
48123 89972
183518 106109
62391 92599
38159 35227
123576 35407
135297 2795
26515 123039
5227 189568
137...

output:

299998

result:

ok single line: '299998'

Test #196:

score: 1
Accepted
time: 738ms
memory: 122692kb

input:

200000 300000
49211 68744
159893 81184
7842 167267
147037 24401
179557 50683
139249 196102
82671 23992
5300 31095
10020 92719
169393 155335
145571 66991
43762 110970
162753 121046
518 169750
142152 1225
163858 47847
175818 87752
17624 116991
162441 167911
60143 69446
178822 190712
150876 138615
6053...

output:

299998

result:

ok single line: '299998'

Test #197:

score: 1
Accepted
time: 702ms
memory: 123408kb

input:

199999 299997
121143 24288
56918 151520
80355 31453
127328 114181
41386 75353
68488 178612
118389 83804
81396 7327
196449 119480
5059 91633
39882 183406
113472 150830
79631 156324
56437 20907
29289 124542
63216 174582
170785 36010
80288 136608
150999 19565
80630 38339
131479 116514
107273 153005
660...

output:

1499979

result:

ok single line: '1499979'

Test #198:

score: 1
Accepted
time: 758ms
memory: 122168kb

input:

200000 300000
123085 130987
133786 55276
66047 96587
121117 89316
65879 158088
112969 133666
48856 144302
85364 149360
152688 54855
14277 55542
94426 191420
127527 146267
51035 54083
171441 117354
187442 62012
110868 57081
103559 196914
83798 3304
12855 157931
126782 84304
199830 21073
27188 102367
...

output:

299998

result:

ok single line: '299998'

Test #199:

score: 1
Accepted
time: 538ms
memory: 117952kb

input:

200000 399999
75304 193763
96495 175415
95911 58205
36773 26952
46110 10428
153219 50635
80654 130153
12145 183657
67366 149350
39433 53482
147678 66400
176928 143004
66435 77664
140532 135656
15839 164234
132707 28606
165094 195457
28283 144029
25794 23353
154632 47498
169673 47910
73578 116729
649...

output:

2284116310884302

result:

ok single line: '2284116310884302'

Test #200:

score: 1
Accepted
time: 499ms
memory: 124440kb

input:

199995 500000
63041 180237
68118 197289
99279 168430
134638 120632
22631 170278
70442 65540
83626 64474
86596 89769
191269 89686
154793 100721
84223 131110
13572 183676
116014 111188
58166 79210
150017 99698
170802 60304
98290 84489
176782 63991
77831 35401
85719 29692
192759 133167
123264 77565
134...

output:

5092712642318620

result:

ok single line: '5092712642318620'

Test #201:

score: 1
Accepted
time: 477ms
memory: 122684kb

input:

200000 500000
64651 120197
182767 85480
148717 92744
25191 107648
141390 38087
124710 150444
95679 104821
108459 147859
190974 13237
130315 56694
97855 95251
98542 108182
69091 64746
125893 64971
54677 111577
173884 186141
87068 158026
166552 195122
133550 50512
170937 134642
179232 132259
146715 27...

output:

5099866262498344

result:

ok single line: '5099866262498344'

Test #202:

score: 1
Accepted
time: 768ms
memory: 127656kb

input:

200000 299999
156177 18990
20425 92963
74386 48300
169620 141656
134269 66712
71804 180990
183694 155493
180194 133253
90792 58840
40201 6762
4347 32517
127941 89193
17112 108353
66858 137401
87148 98305
93666 153758
106289 188882
21392 9216
5990 10914
102935 154988
108652 138570
60037 114375
114530...

output:

813258

result:

ok single line: '813258'

Test #203:

score: 1
Accepted
time: 777ms
memory: 128164kb

input:

200000 299999
143247 12619
91146 81172
115488 70209
91307 34319
144776 20031
133531 116544
108907 11261
197339 14634
149684 173989
26495 167498
67565 88417
165353 47232
71740 29574
142318 31400
197922 152800
96916 53591
43062 160048
50718 135989
45390 9636
2032 28017
98434 129109
185117 13892
43890 ...

output:

800097

result:

ok single line: '800097'

Test #204:

score: 1
Accepted
time: 603ms
memory: 123064kb

input:

200000 333329
105789 191007
14222 116107
17551 97353
144254 115493
2905 48762
154091 84512
78213 54781
190444 78587
186049 44840
56872 161626
195176 104385
116276 172540
76751 118907
180836 21268
135206 136891
13354 141877
113237 6803
20145 155363
183625 49850
142453 85288
33185 177916
196005 174249...

output:

120068899721

result:

ok single line: '120068899721'

Test #205:

score: 1
Accepted
time: 696ms
memory: 127364kb

input:

200000 333329
67410 186656
58977 8739
133575 129556
169178 64180
39801 10743
87900 20142
188195 153233
46360 89787
94246 53893
178555 108815
37205 185668
167714 51372
171055 91479
143240 97476
137878 169951
58688 41193
33593 61930
28742 39304
14937 156827
170961 94049
89243 75282
45031 183992
121997...

output:

111532413528

result:

ok single line: '111532413528'

Test #206:

score: 1
Accepted
time: 412ms
memory: 108056kb

input:

3207 500000
2020 2698
2346 1131
2759 1562
2786 1578
802 2789
2104 1927
164 1179
865 1956
487 2157
2447 975
2803 3036
1323 2376
3188 2
2467 1898
2730 3039
1159 1345
2247 2999
2310 1891
1768 144
202 1342
417 2120
388 2897
1416 3016
406 814
1519 5
822 2320
774 250
2083 847
2508 354
892 148
1733 3080
11...

output:

1

result:

ok single line: '1'

Test #207:

score: 1
Accepted
time: 461ms
memory: 112464kb

input:

20000 500000
7151 1295
15546 6577
8437 4499
2270 5661
18213 17915
11896 11230
18917 9072
5166 9314
17358 8021
11814 11485
3924 10336
19301 2387
12461 17862
12004 1677
935 5214
13067 11195
3207 6451
15159 10572
4881 1865
8853 19661
18857 12237
18099 1757
15181 3255
19229 18442
9767 3608
13045 10108
3...

output:

99

result:

ok single line: '99'

Test #208:

score: 1
Accepted
time: 79ms
memory: 76924kb

input:

200000 199999
93736 181403
156112 102208
16713 42327
131616 136885
70397 192704
107526 90095
149170 86716
84618 100554
73617 118429
35205 13899
32583 24790
74156 110676
76975 9457
88919 62362
89334 120560
122263 182583
128258 41469
6656 85673
180229 59265
181959 3655
74663 117206
26748 172404
80016 ...

output:

1333293333699999

result:

ok single line: '1333293333699999'

Test #209:

score: 1
Accepted
time: 384ms
memory: 112512kb

input:

199998 333327
154173 44857
152366 156140
177293 140845
24220 16142
140845 171682
149257 109144
105253 28346
75674 76866
32698 2257
2215 85619
157445 105253
85644 162323
56456 11939
61212 158180
129123 146083
48359 174948
68444 48602
144324 19261
135615 44071
160278 18600
37736 36929
57367 157448
979...

output:

22298376031

result:

ok single line: '22298376031'

Test #210:

score: 1
Accepted
time: 305ms
memory: 98308kb

input:

199956 300091
78717 6081
126123 178266
165601 34029
35135 7502
99001 32681
79499 116679
145115 9429
140814 43578
177947 105419
52841 107817
178577 70303
22186 94005
69748 28268
128507 17040
178047 174057
143272 183890
6169 50841
70348 187945
112271 156333
32016 64725
115259 81626
84776 177182
53362 ...

output:

1642790675970778

result:

ok single line: '1642790675970778'

Test #211:

score: 1
Accepted
time: 310ms
memory: 99028kb

input:

199647 295732
98231 27546
73847 125881
169793 173033
151343 30708
99780 81679
12542 185236
118979 22502
183133 79848
17977 155934
166240 192965
126032 53713
112367 70819
89928 98073
120322 115390
125545 145761
26241 173065
158934 51841
34165 162623
79380 12550
19631 162343
172707 130106
146074 81358...

output:

1679093198423900

result:

ok single line: '1679093198423900'

Test #212:

score: 1
Accepted
time: 268ms
memory: 98372kb

input:

199994 321863
39805 11163
86073 193219
34502 150668
5289 144322
175537 142589
77844 140834
142620 138803
12533 119196
22133 3856
157329 133701
191622 157489
179582 30542
83603 67556
81003 13712
184235 11302
80873 172415
155706 162890
35657 118620
102472 182719
129490 156382
194611 191529
168701 1031...

output:

2166640153802314

result:

ok single line: '2166640153802314'

Test #213:

score: 1
Accepted
time: 304ms
memory: 100780kb

input:

199995 337545
163138 135797
180589 54963
15734 184837
6468 3969
94740 107403
79126 90767
162754 199432
156502 132586
192280 91983
128714 41833
5855 70256
64871 198936
121202 38040
35353 133685
171096 78772
52311 9118
126394 87140
126941 43840
105482 2015
126529 68878
194600 57147
163052 57025
198234...

output:

1567413769473962

result:

ok single line: '1567413769473962'

Subtask #10:

score: 1
Accepted

Test #214:

score: 1
Accepted
time: 814ms
memory: 147000kb

input:

200000 500000
96760 112554
29323 168994
89784 103554
72230 56614
72441 184640
409 79524
137579 154258
176 98259
27225 66351
135833 195396
31261 115021
12999 157947
96082 24545
130808 58489
59300 142171
128138 77303
192454 105413
102811 151935
139420 157027
70134 188719
122103 154600
106433 9386
1513...

output:

502166260941108

result:

ok single line: '502166260941108'

Test #215:

score: 1
Accepted
time: 651ms
memory: 128764kb

input:

200000 427739
127977 100843
89048 40499
66185 178842
828 90180
166916 28872
193049 81418
139927 33089
19724 77324
181786 868
109567 175482
140139 21345
89840 117140
11475 156660
93102 30213
82938 78658
136384 191425
81846 45118
6975 178872
97360 192225
181680 179206
124463 167229
56646 48671
83388 6...

output:

779106485728385

result:

ok single line: '779106485728385'

Test #216:

score: 1
Accepted
time: 628ms
memory: 128524kb

input:

200000 423932
68428 195289
90165 145964
175169 150397
144535 158736
24154 23576
82934 133601
189658 129371
99728 47747
86947 64028
77875 6079
95830 59255
146656 111315
148167 151946
40391 172726
110204 50886
26946 156223
154797 102345
186588 5321
96803 134707
17137 144807
80216 171675
11503 124623
6...

output:

796082632989835

result:

ok single line: '796082632989835'

Test #217:

score: 1
Accepted
time: 815ms
memory: 137784kb

input:

200000 499999
23694 190972
53323 141164
165184 44748
37521 119931
162672 126650
78937 142838
182169 961
97596 146721
172934 124013
18762 162933
35614 168961
27147 169518
22720 17551
125559 163048
172457 162384
111773 31979
179547 9114
171005 150944
194723 7695
186393 105637
63472 64643
14440 94046
1...

output:

288069256104

result:

ok single line: '288069256104'

Test #218:

score: 1
Accepted
time: 752ms
memory: 123044kb

input:

200000 300000
115365 100769
8662 66630
26881 78833
54397 99714
33713 63004
24256 158018
111257 72164
107903 179206
73914 118387
173528 132808
183486 112837
120707 198233
113895 142721
125907 169872
44251 162817
174375 32240
178914 22147
129815 147851
13059 128803
110325 161621
87940 171997
145978 18...

output:

299998

result:

ok single line: '299998'

Test #219:

score: 1
Accepted
time: 782ms
memory: 122300kb

input:

199999 299997
193233 142262
103819 38371
127482 43519
56189 30048
21826 126624
112476 81784
87383 168712
64546 184730
123702 187090
93751 53133
172500 179285
59840 106153
94269 116428
75723 121056
100987 107711
31844 60587
148657 74728
3307 45032
7757 162535
175291 143379
107090 145552
12189 83601
1...

output:

7500170

result:

ok single line: '7500170'

Test #220:

score: 1
Accepted
time: 751ms
memory: 121392kb

input:

199999 299997
29117 134589
150470 111425
132938 160631
138695 103710
187135 89801
165893 144239
156661 65334
187006 173334
134996 44313
143544 43101
148226 107311
107294 83424
199598 103759
70356 115835
147673 131143
6129 71840
25864 136529
155942 157992
123804 105484
65127 194823
73167 6108
58115 8...

output:

2099978

result:

ok single line: '2099978'

Test #221:

score: 1
Accepted
time: 331ms
memory: 100172kb

input:

199995 299996
166941 109031
11396 91474
11971 140613
92583 62340
51265 143271
189499 72473
14578 6659
104743 179564
130421 1769
176915 71006
20720 151105
146080 167222
8761 103363
37633 136090
39181 169144
182696 164877
43344 77616
84359 123028
75641 110173
190631 43306
133296 59425
24540 87176
7253...

output:

1980660448940467

result:

ok single line: '1980660448940467'

Test #222:

score: 1
Accepted
time: 670ms
memory: 128896kb

input:

200000 483374
75762 52815
48605 67014
193624 94801
83566 16372
146321 174788
87670 198992
8357 33626
94553 162248
26242 131916
108393 167787
170981 37984
174520 179211
195868 106486
51593 144112
124271 184501
33408 21988
8428 46490
97862 194734
175984 71296
73331 5272
171987 172553
175808 63269
1528...

output:

2909941451903680

result:

ok single line: '2909941451903680'

Test #223:

score: 1
Accepted
time: 493ms
memory: 125424kb

input:

199996 500000
25627 52117
32102 69202
37157 178600
116011 152777
24564 24423
136788 38009
31440 169269
71096 39718
71213 22064
174182 20195
70967 184686
92104 89017
59209 37190
181228 173876
105639 55639
175993 17322
104029 141571
72093 10044
173125 74223
183789 60209
190518 65021
4660 172273
146302...

output:

5079540046820501

result:

ok single line: '5079540046820501'

Test #224:

score: 1
Accepted
time: 730ms
memory: 128984kb

input:

200000 299999
77369 195467
111231 190685
71556 18964
171559 101208
112432 165480
150367 11431
177574 177035
175725 180232
164402 87554
71631 183312
1167 144803
123288 107605
191105 107102
28262 178246
32686 1187
24827 169209
82669 87855
154190 39948
109157 118671
184406 166422
4827 31278
183336 1628...

output:

899993

result:

ok single line: '899993'

Test #225:

score: 1
Accepted
time: 749ms
memory: 125880kb

input:

200000 299999
153374 169879
38960 25006
151942 147888
70876 196330
54290 7280
102017 88589
124899 110368
27601 160953
116887 29985
179367 129499
52644 23123
4578 182921
85416 199537
46585 55261
178922 174378
40441 77235
42552 85226
154309 64673
78626 27816
15610 164571
48601 144284
71615 13449
79979...

output:

802258

result:

ok single line: '802258'

Test #226:

score: 1
Accepted
time: 460ms
memory: 114424kb

input:

200000 333329
107054 35081
7547 87106
42232 197030
198084 11897
48536 115694
76182 37160
5942 32947
120938 58031
135909 6333
152955 151959
37484 155874
139141 59285
60615 94888
112673 47953
93613 9358
142421 150896
161137 182174
107603 133862
89761 33803
31574 195723
146086 21561
65080 168366
35008 ...

output:

133339266470

result:

ok single line: '133339266470'

Test #227:

score: 1
Accepted
time: 678ms
memory: 123412kb

input:

199958 333259
98780 124003
165532 180572
47660 156964
176667 2197
90672 19652
124182 37955
93354 77636
194019 183593
100971 12160
122456 169738
61760 181625
180579 163328
119603 119823
130973 57271
86421 136760
4235 7987
56333 102533
111340 119933
148660 187736
3649 56786
134618 126334
89726 74166
1...

output:

114096394031

result:

ok single line: '114096394031'

Test #228:

score: 1
Accepted
time: 728ms
memory: 125104kb

input:

200000 333329
29815 95543
30463 162831
60123 74945
59856 37428
105958 110252
32896 168995
61894 70240
151861 164989
61385 190214
85841 150441
148688 74978
81141 106205
25439 68688
106453 24591
105167 134762
155186 31691
127434 174307
166891 108318
169319 199633
61100 70342
69515 166587
71194 135011
...

output:

111152421330

result:

ok single line: '111152421330'

Test #229:

score: 1
Accepted
time: 491ms
memory: 111420kb

input:

16000 500000
12217 4633
5081 6127
3648 11397
1534 7540
3476 1541
10274 15563
13422 6668
9838 1717
7568 12934
6238 7683
15836 297
3297 7896
12121 5958
13514 3848
9038 12414
3370 8217
11590 12756
14550 6283
1967 4950
12334 12705
14649 6858
7277 14905
1970 1912
3342 6074
8454 8129
7224 413
5559 12686
8...

output:

399

result:

ok single line: '399'

Test #230:

score: 1
Accepted
time: 563ms
memory: 113764kb

input:

50000 500000
44936 21493
37198 5109
44727 4200
211 14613
2898 8727
17399 2337
34159 11829
42188 46830
4960 6213
48634 1044
18005 45549
19367 3719
8359 43230
44616 21173
34743 43156
12552 31596
33031 30676
25356 24067
25769 40775
36486 39300
12898 11422
36216 21490
16745 17112
14409 5956
40222 36667
...

output:

49

result:

ok single line: '49'

Test #231:

score: 1
Accepted
time: 79ms
memory: 82920kb

input:

200000 200000
23533 30847
153259 94335
187602 102211
115644 46249
51516 43961
118305 147917
3836 74479
108697 135521
40277 163136
91587 129869
196397 126235
180893 148345
16082 155524
12346 293
57898 83326
15349 161611
63513 56640
77327 38108
175550 105789
128248 65841
182213 66818
176660 180939
694...

output:

1333313333400000

result:

ok single line: '1333313333400000'

Test #232:

score: 1
Accepted
time: 292ms
memory: 97920kb

input:

199944 297033
160165 68194
162109 190131
189594 161979
24147 50476
197206 110014
17218 178641
177826 79364
131916 190427
1392 196737
66028 22895
56691 47052
148306 144402
75522 45752
67283 50552
163714 110222
92697 23887
194226 152341
167827 173659
8723 85254
44688 19777
63418 138931
71522 160054
37...

output:

1670311821962742

result:

ok single line: '1670311821962742'

Test #233:

score: 1
Accepted
time: 301ms
memory: 96924kb

input:

199921 294029
94804 115724
168037 91943
104267 178393
21243 113662
97086 54346
33510 62264
189107 70064
127173 43575
2085 126369
182377 195859
150077 153569
33663 189575
79547 19091
124503 174895
66948 193119
159118 150375
29341 118995
17057 176546
134296 135484
58992 10858
142089 134998
187450 1750...

output:

1673974916697347

result:

ok single line: '1673974916697347'

Test #234:

score: 1
Accepted
time: 332ms
memory: 97500kb

input:

199707 295771
56110 8008
184773 152177
84382 142105
54063 56615
60937 108106
111439 83590
75808 184105
190932 191490
39078 2329
147963 108526
14284 28314
121173 187786
96877 32555
198759 190921
118674 30008
137544 71817
143040 179821
115469 185621
195223 197378
136378 153655
40608 199659
166590 1683...

output:

1700821491912155

result:

ok single line: '1700821491912155'

Test #235:

score: 1
Accepted
time: 256ms
memory: 97252kb

input:

199994 310103
80988 90689
195815 129511
139848 182341
11124 158607
156345 36690
57269 129830
129489 145856
170243 150382
181537 124126
101551 102514
141374 89897
21509 135047
87697 67865
192595 169404
198041 79987
90143 193164
65031 171734
146322 21521
10224 72144
70216 95708
120164 161289
192187 12...

output:

2479128572728802

result:

ok single line: '2479128572728802'