QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#29395#410. TelegraphETK100 ✓9ms5924kbC++231.4kb2022-04-17 17:22:012024-07-05 05:49:51

Judging History

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

  • [2024-07-05 05:49:51]
  • 评测
  • 测评结果:100
  • 用时:9ms
  • 内存:5924kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-17 17:22:01]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define ll long long
using namespace std;
inline ll read(){
    ll x=0,f=1;char ch=getchar();
    while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
    while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
    return x*f;
}
const int N=1e5+5;
int n,a[N],c[N],mx[N],mx2[N],vis[N];
ll ans;
int main(){
    n=read();
    rep(i,1,n){
        a[i]=read();c[i]=read();
        ans+=c[i];
    }
    rep(i,1,n){
        if(!vis[i]){
            int x=i;
            for(;!vis[x];x=a[x]){
                vis[x]=i;
            }
            if(vis[x]==i){
                int siz=0;
                for(;vis[x]!=-1;x=a[x]){
                    ++siz,vis[x]=-1;
                }
                if(siz==n)return puts("0"),0;
            }
        }
    }
    rep(i,1,n){
        mx[a[i]]=max(mx[a[i]],c[i]);
        if(vis[i]!=-1)mx2[a[i]]=max(mx2[a[i]],c[i]);
    }
    rep(i,1,n)ans-=mx[i];
    rep(i,1,n){
        if(vis[i]==-1){
            int mn=2e9;
            for(int x=i;vis[x]==-1;x=a[x]){
                mn=min(mn,mx[x]-mx2[x]);
                vis[x]=0;
            }
            ans+=mn;
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 3992kb

input:

10
3 85377744
3 191391530
4 553475509
8 344887257
9 812158120
1 880268352
4 686078706
7 182546394
4 220137367
3 89957933

output:

1081551750

result:

ok single line: '1081551750'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3932kb

input:

10
3 688989554
5 112566798
1 294281317
1 96941112
6 746415334
2 612836992
9 629868215
1 406822326
10 638640051
8 199983696

output:

503789227

result:

ok single line: '503789227'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

10
3 292601364
7 33742065
7 35087125
3 996478615
4 828156197
3 197921984
8 426174077
4 631098259
5 57142735
5 457493107

output:

1212506407

result:

ok single line: '1212506407'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

10
6 43696822
9 954917333
7 923376581
5 896016118
1 762413411
4 930490625
3 369963586
9 855374192
2 475645419
1 567518871

output:

1936096612

result:

ok single line: '1936096612'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3880kb

input:

10
6 647308632
3 876092601
4 664182389
6 648069973
7 844154274
5 663059265
1 166269448
3 79650124
7 894148102
7 825028282

output:

2396141312

result:

ok single line: '2396141312'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

10
5 415342264
1 248144257
7 494844360
9 110058957
4 614196536
3 303926057
10 44559777
2 165167138
6 41487942
8 935054045

output:

0

result:

ok single line: '0'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

10
10 898367504
9 980712897
2 504348852
3 53848467
7 33871940
1 528201989
6 811131714
5 583669822
8 801282745
4 45079808

output:

0

result:

ok single line: '0'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

10
7 381392744
6 713281537
2 366369696
5 850154328
3 306063696
8 752477922
10 430220003
1 2172506
4 413593900
9 302589220

output:

0

result:

ok single line: '0'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

10
8 864417984
5 298366530
2 375874188
1 793943838
6 578255452
4 976753854
3 49308293
10 420675190
7 25905054
9 412614983

output:

0

result:

ok single line: '0'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

10
8 199959576
4 30935170
2 237895032
7 590249700
10 997930856
5 53546139
1 668396582
6 839177874
3 638216209
9 670124394

output:

0

result:

ok single line: '0'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

10
3 682984816
1 750527363
4 747399524
9 770122612
4 277822071
1 763503810
2 780150157
3 534039209
2 787484871
9 110196910

output:

2452735710

result:

ok single line: '2452735710'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

10
3 609420368
6 510322166
8 542314367
1 330345071
2 37659569
1 666010057
6 348588802
2 554056808
3 502098004
8 528699593

output:

1761005813

result:

ok single line: '1761005813'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

10
8 274134580
10 961989771
9 622633320
10 947202277
2 726373936
3 147685332
9 81157442
2 618924860
8 649035297
3 673145097

output:

2069104491

result:

ok single line: '2069104491'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

10
2 734181527
3 792233387
5 734944475
1 950649869
6 632060537
1 628429351
3 257711095
6 70440442
2 365704961
5 813726083

output:

2057230324

result:

ok single line: '2057230324'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

10
5 911321676
6 14229951
10 398811075
1 784207645
10 847255630
8 990450195
5 515220506
1 506373283
8 174925801
6 967602129

output:

1609560616

result:

ok single line: '1609560616'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

10
6 926048691
6 399201736
4 999954689
7 999954691
4 131379719
5 399201738
1 958019465
5 131379717
1 926048690
7 958019463

output:

2546029325

result:

ok single line: '2546029325'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

10
10 198240446
6 861975533
2 861975531
9 863948357
6 754325322
10 754325324
8 623477668
9 623477670
2 863948359
8 198240447

output:

2636259416

result:

ok single line: '2636259416'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3880kb

input:

10
5 2
6 1
2 2
9 4
2 4
4 4
4 2
2 2
5 4
9 2

output:

11

result:

ok single line: '11'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

10
9 4
1 4
2 2
2 4
9 2
9 2
4 4
4 2
7 1
1 2

output:

11

result:

ok single line: '11'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

10
4 729237416
6 914170628
10 148821816
1 56295050
7 162299358
2 743005359
5 438210203
9 722952110
8 360316619
3 154246770

output:

1470738202

result:

ok single line: '1470738202'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

10
9 256452
7 373097749
6 470342382
8 605026203
10 234516065
3 358737448
2 773335059
4 499255620
1 668606205
5 434491114

output:

1465863334

result:

ok single line: '1465863334'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

10
7 854166518
5 231824260
10 701295161
3 280917360
6 178305574
9 597373681
4 392423348
2 727851793
8 418759136
1 614530695

output:

459222934

result:

ok single line: '459222934'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

10
8 476551539
5 837877557
10 122095084
6 40712162
3 964392900
1 36836753
4 11511637
7 126358274
2 837261820
9 821649614

output:

133606721

result:

ok single line: '133606721'

Test #24:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

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

output:

5

result:

ok single line: '5'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3936kb

input:

10
6 2
9 2
2 2
6 2
6 1
7 1
3 1
1 1
2 2
9 1

output:

6

result:

ok single line: '6'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3880kb

input:

10
8 2
3 2
1 2
8 1
2 2
8 1
1 2
4 1
7 2
6 2

output:

4

result:

ok single line: '4'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

10
9 1
4 2
7 2
1 1
1 1
9 3
6 1
7 1
3 3
2 2

output:

4

result:

ok single line: '4'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

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

output:

5

result:

ok single line: '5'

Test #29:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

10
9 3
6 3
2 2
5 2
3 3
1 2
9 3
5 3
6 1
7 1

output:

6

result:

ok single line: '6'

Test #30:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

10
2 4
8 3
8 5
5 4
8 4
2 3
8 4
9 3
3 4
3 3

output:

18

result:

ok single line: '18'

Test #31:

score: 0
Accepted
time: 0ms
memory: 3932kb

input:

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

output:

5

result:

ok single line: '5'

Test #32:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

10
3 2
3 3
5 1
9 2
4 1
2 3
1 3
7 4
4 4
5 3

output:

6

result:

ok single line: '6'

Test #33:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

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

output:

2

result:

ok single line: '2'

Test #34:

score: 0
Accepted
time: 0ms
memory: 3936kb

input:

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

output:

2

result:

ok single line: '2'

Test #35:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

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

output:

2

result:

ok single line: '2'

Test #36:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

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

output:

2

result:

ok single line: '2'

Test #37:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

10
3 724712539
3 253848450
6 356739170
3 814029021
3 121198630
3 482935623
3 674461095
3 302762682
3 263140130
3 908035622

output:

3637088170

result:

ok single line: '3637088170'

Test #38:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

10
8 373165894
8 38304954
8 946652851
8 68020615
8 672351134
8 520346777
8 246552191
4 839764410
8 740286919
8 586733383

output:

3245761867

result:

ok single line: '3245761867'

Test #39:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

10
2 322789650
7 800589256
5 218844607
10 132657931
8 115097238
4 90853818
1 596237875
3 42858053
4 630675305
6 359375208

output:

456501521

result:

ok single line: '456501521'

Test #40:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

10
8 509356502
1 125947146
7 339373171
3 638520011
8 740701068
9 805814890
4 986647562
2 892452734
10 533157896
6 458258719

output:

1306988392

result:

ok single line: '1306988392'

Test #41:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

4
2 73822429
1 696182050
1 415286834
3 921421058

output:

489109263

result:

ok single line: '489109263'

Test #42:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

6
3 258660948
4 317460220
5 307161079
3 306951059
2 624381722
3 329784054

output:

565612007

result:

ok single line: '565612007'

Test #43:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

6
3 443499466
1 86222039
4 199035324
3 692481060
1 107406962
3 339288546

output:

1068045375

result:

ok single line: '1068045375'

Test #44:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

7
6 628337985
3 707500209
2 90909568
5 78011060
4 590432202
4 201309390
6 874770682

output:

998568003

result:

ok single line: '998568003'

Test #45:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

7
4 813176504
5 328778380
4 130267461
5 611024709
1 73457443
1 210813882
4 146962438

output:

679465722

result:

ok single line: '679465722'

Test #46:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

2
2 998015023
1 939245867

output:

0

result:

ok single line: '0'

Test #47:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

10
9 218687433
6 82339218
7 150723185
10 838829597
4 909304699
8 607048818
5 143907993
3 326114464
2 953332355
1 396378244

output:

0

result:

ok single line: '0'

Test #48:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

10
6 951256073
8 91843710
1 94512695
9 111021353
2 133580631
5 226137107
3 562410677
4 938425619
10 63358118
7 32163581

output:

0

result:

ok single line: '0'

Subtask #2:

score: 30
Accepted

Dependency #1:

100%
Accepted

Test #49:

score: 30
Accepted
time: 0ms
memory: 3864kb

input:

15
12 85377744
1 191391530
11 553475509
9 344887257
3 812158120
7 880268352
8 686078706
11 182546394
13 220137367
6 89957933
10 715669848
3 196032869
5 68706224
12 212567593
13 964776170

output:

684094374

result:

ok single line: '684094374'

Test #50:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

15
7 688989554
6 112566798
7 294281317
6 96941112
14 746415334
4 612836992
2 629868215
9 406822326
8 638640051
14 199983696
4 705596425
6 905127765
7 507689114
3 728980284
3 46064176

output:

2277185531

result:

ok single line: '2277185531'

Test #51:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

15
2 292601364
11 33742065
4 35087125
3 996478615
12 828156197
2 197921984
12 426174077
7 631098259
3 57142735
9 457493107
14 548039354
11 614222660
11 799188357
8 245392975
7 274835829

output:

1639126475

result:

ok single line: '1639126475'

Test #52:

score: 0
Accepted
time: 0ms
memory: 3936kb

input:

15
14 43696822
3 954917333
2 923376581
13 896016118
9 762413411
14 930490625
6 369963586
7 855374192
13 475645419
3 567518871
10 537965931
3 323317556
14 90687600
13 761805666
11 356123834

output:

2650070396

result:

ok single line: '2650070396'

Test #53:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

15
9 647308632
7 876092601
12 664182389
10 648069973
6 844154274
12 663059265
2 166269448
5 79650124
8 894148102
12 825028282
3 380408860
6 32412452
1 529670491
3 130734709
2 584895488

output:

1656658263

result:

ok single line: '1656658263'

Test #54:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

15
10 303926057
6 44559777
2 165167138
1 41487942
4 935054045
12 494604551
11 370335437
14 48311303
5 888990996
13 830561190
9 821169733
7 128365592
15 647147401
3 648156432
8 666183493

output:

0

result:

ok single line: '0'

Test #55:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

15
4 528201989
15 811131714
9 583669822
5 801282745
11 45079808
3 130389889
6 212778366
7 819579429
12 598085892
8 411735302
2 112668976
14 755814271
10 163560092
1 171593356
13 894955146

output:

0

result:

ok single line: '0'

Test #56:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

15
8 752477922
3 430220003
4 2172506
10 413593900
11 302589220
14 913658874
2 202704943
6 443363906
7 307180788
5 140393062
13 551651867
15 383262950
1 679972783
12 695030280
9 976243151

output:

0

result:

ok single line: '0'

Test #57:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

15
15 976753854
14 49308293
12 420675190
11 25905054
2 412614983
13 696927860
9 45147872
7 214632031
3 16275684
4 721567174
1 843151110
10 10711628
8 48901826
6 218467204
5 57531157

output:

0

result:

ok single line: '0'

Test #58:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

15
8 53546139
14 668396582
1 839177874
15 638216209
10 670124394
4 332713198
13 35074449
6 985900156
7 725370579
12 302741286
3 134650352
2 638160307
11 565314517
9 889387776
5 286302810

output:

0

result:

ok single line: '0'

Test #59:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

14
8 787484871
11 573633243
10 615982183
3 25001026
1 110196910
13 277822071
8 780150157
3 750527363
12 81727208
11 609684634
12 883915398
13 765608986
1 770122612
10 434465475

output:

2290330804

result:

ok single line: '2290330804'

Test #60:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

14
8 502098004
11 528699593
4 598139899
8 540541312
7 37659569
10 899251169
6 510322166
11 542314367
10 143560371
14 880952759
7 554056808
6 867443955
14 865132486
4 965089510

output:

3185612088

result:

ok single line: '3185612088'

Test #61:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

14
3 504737236
3 156631729
10 546263623
10 114552590
8 961989771
13 622633320
1 138915
6 673145097
6 147685332
5 667989991
8 947202277
13 857370533
1 535036507
5 726373936

output:

2656834154

result:

ok single line: '2656834154'

Test #62:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

14
5 734181527
13 257711095
5 365704961
6 595614619
13 792233387
12 774921383
1 950649869
12 483481633
14 709233811
11 699813462
14 818305492
1 795438670
11 734944475
6 776005362

output:

3906998251

result:

ok single line: '3906998251'

Test #63:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

14
2 689740039
9 601574478
9 418328707
2 847255630
10 174925801
13 784207645
4 515220506
11 999894324
14 547273487
13 506373283
10 922887349
14 887113862
4 911321676
11 856095495

output:

3707957318

result:

ok single line: '3707957318'

Test #64:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

14
14 459566784
5 399201736
14 55226683
3 55226682
10 399201738
7 532182968
5 532182970
13 625246270
10 530409965
3 530409967
12 737359816
7 737359818
12 625246272
13 459566786

output:

2525852865

result:

ok single line: '2525852865'

Test #65:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

14
7 149498254
9 473729367
7 623477670
3 623477669
14 522109547
14 520628805
2 149498256
6 520628803
10 71877941
6 882755685
9 71877939
2 473729365
10 882755683
3 522109549

output:

2006119547

result:

ok single line: '2006119547'

Test #66:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

14
10 4
8 2
10 2
5 4
1 4
10 2
5 2
12 4
8 4
9 1
12 2
4 4
4 2
1 2

output:

15

result:

ok single line: '15'

Test #67:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

14
4 4
5 2
5 4
12 4
7 4
12 2
1 4
13 2
13 2
1 2
7 2
13 4
3 1
4 2

output:

15

result:

ok single line: '15'

Test #68:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

14
11 111286834
10 418724310
12 360316619
13 148821816
9 56295050
7 196921980
6 108646817
14 639577372
5 729237416
2 434474131
1 409449704
3 722952110
4 154246770
8 207614390

output:

1411705836

result:

ok single line: '1411705836'

Test #69:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

14
2 358737448
1 470342382
14 773335059
12 835063069
9 879914943
10 256452
11 990623816
13 942161234
5 186848557
6 668606205
7 820381730
4 931076615
8 950886822
3 373097749

output:

3516546239

result:

ok single line: '3516546239'

Test #70:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

14
11 280917360
9 462511748
1 392423348
12 418759136
2 571797928
13 222575858
4 597373681
6 529476626
3 854166518
5 503699420
10 142006434
14 727851793
7 319815865
8 29291486

output:

171297920

result:

ok single line: '171297920'

Test #71:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

14
11 837261820
4 836228556
10 925275419
1 821649614
2 661558748
13 126358274
6 89960427
7 152972040
5 238571521
8 274967545
14 837877557
3 40712162
12 11511637
9 19218063

output:

30729700

result:

ok single line: '30729700'

Test #72:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

15
2 2
13 2
4 2
5 1
10 1
7 1
5 1
3 2
10 2
1 2
5 1
11 1
8 1
3 1
13 2

output:

6

result:

ok single line: '6'

Test #73:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

15
11 2
3 2
1 2
2 2
6 1
5 1
13 1
3 1
4 2
9 1
1 2
14 1
10 2
8 2
3 1

output:

5

result:

ok single line: '5'

Test #74:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

15
8 2
8 2
13 2
13 1
3 2
3 1
9 2
1 1
13 2
4 2
10 1
5 1
14 1
13 1
7 1

output:

7

result:

ok single line: '7'

Test #75:

score: 0
Accepted
time: 0ms
memory: 3996kb

input:

15
4 1
13 2
9 2
10 1
2 1
1 3
3 1
13 1
8 3
12 2
4 3
8 2
1 1
4 3
10 1

output:

9

result:

ok single line: '9'

Test #76:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

15
13 2
4 3
6 2
6 3
12 1
11 2
13 3
13 1
3 2
7 2
14 2
14 1
3 1
8 2
2 1

output:

7

result:

ok single line: '7'

Test #77:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

15
8 3
7 3
2 2
3 2
9 3
10 2
8 3
10 3
14 1
4 1
7 2
5 1
7 3
13 1
6 2

output:

10

result:

ok single line: '10'

Test #78:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

15
5 4
12 3
12 5
13 4
6 4
8 3
3 4
9 3
10 4
12 3
3 4
8 5
9 4
6 2
10 5

output:

22

result:

ok single line: '22'

Test #79:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

15
2 2
3 5
9 3
10 4
4 2
7 3
13 3
9 1
5 3
7 2
13 3
14 1
11 1
10 3
14 3

output:

10

result:

ok single line: '10'

Test #80:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

15
10 2
8 3
7 1
7 2
1 1
2 3
8 3
6 4
14 4
1 3
6 5
5 2
14 2
1 4
6 3

output:

17

result:

ok single line: '17'

Test #81:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

15
15 2
3 2
6 2
9 2
8 1
7 2
10 2
14 2
11 2
8 2
12 2
1 2
2 2
4 2
13 2

output:

2

result:

ok single line: '2'

Test #82:

score: 0
Accepted
time: 0ms
memory: 3988kb

input:

15
6 2
9 1
10 2
8 2
1 2
9 2
3 2
5 2
12 2
11 2
4 2
14 2
15 2
13 2
7 2

output:

2

result:

ok single line: '2'

Test #83:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

15
9 1
12 3
8 3
6 3
14 3
5 3
4 3
15 3
10 1
7 3
13 3
9 3
3 3
11 3
2 3

output:

2

result:

ok single line: '2'

Test #84:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

15
13 3
8 1
11 3
2 1
10 3
5 3
3 3
15 3
1 3
14 3
6 3
9 3
2 3
12 3
7 3

output:

2

result:

ok single line: '2'

Test #85:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

15
3 263140130
3 623555286
8 814029021
3 335303059
3 332482739
3 907086607
3 460867359
3 121198630
3 6139331
3 253848450
3 908035622
3 103399081
3 731860554
3 993288255
3 316692873

output:

5363609721

result:

ok single line: '5363609721'

Test #86:

score: 0
Accepted
time: 0ms
memory: 3992kb

input:

15
3 313034666
3 520346777
6 38304954
3 106571185
3 672351134
3 740286919
3 789408317
3 430523530
3 835731184
3 771465630
3 373165894
3 332170734
3 169962255
3 139967977
3 944141552

output:

6194986202

result:

ok single line: '6194986202'

Test #87:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

15
15 953960454
3 825657761
9 730355662
13 359375208
6 572677302
8 132657931
1 508897020
5 630675305
2 879057151
12 41692427
4 115097238
14 62964872
11 90853818
10 571590230
7 413458739

output:

1409018577

result:

ok single line: '1409018577'

Test #88:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

15
7 25309711
8 125947146
10 208462640
14 668100690
9 354464115
3 740701068
12 477397378
11 509356502
13 199038909
6 892452734
2 339373171
1 642230393
5 622866539
15 501623787
4 588152047

output:

1060382193

result:

ok single line: '1060382193'

Test #89:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

3
2 73822429
1 696182050
1 415286834

output:

489109263

result:

ok single line: '489109263'

Test #90:

score: 0
Accepted
time: 0ms
memory: 3988kb

input:

14
13 258660948
13 317460220
1 307161079
5 306951059
7 624381722
8 329784054
8 182903522
2 364123724
10 117075043
11 775000611
5 896676390
10 785214763
10 601419915
1 671754874

output:

1774171566

result:

ok single line: '1774171566'

Test #91:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

9
4 443499466
8 86222039
8 199035324
8 692481060
3 107406962
8 339288546
3 602578926
9 983212013
1 729386198

output:

1085145385

result:

ok single line: '1085145385'

Test #92:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

5
2 628337985
4 707500209
4 90909568
3 78011060
2 590432202

output:

681341770

result:

ok single line: '681341770'

Test #93:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

14
4 813176504
12 328778380
8 130267461
3 611024709
8 73457443
5 210813882
11 146962438
9 221388592
2 101492155
7 977323920
3 62997118
6 676220747
11 483765951
10 242065645

output:

283416999

result:

ok single line: '283416999'

Test #94:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

11
7 72834726
11 206933676
9 566637842
2 685028766
3 987960529
8 872888957
5 713803309
10 843306592
6 613109258
4 165209208
1 834265243

output:

0

result:

ok single line: '0'

Test #95:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

7
2 382084710
3 32630246
4 892024275
6 218687433
7 82339218
5 150723185
1 838829597

output:

0

result:

ok single line: '0'

Test #96:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2
2 781596402
1 192612891

output:

0

result:

ok single line: '0'

Subtask #3:

score: 30
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #97:

score: 30
Accepted
time: 1ms
memory: 3848kb

input:

3000
2020 85377744
1809 191391530
681 553475509
1252 344887257
1810 812158120
1961 880268352
978 686078706
261 182546394
2253 220137367
1367 89957933
535 715669848
784 196032869
1136 68706224
301 212567593
2203 964776170
2030 301950428
1584 426542625
2743 941604921
2909 994719311
2512 659998485
1485...

output:

364842017504

result:

ok single line: '364842017504'

Test #98:

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

input:

3000
2325 688989554
2961 112566798
1568 294281317
1443 96941112
2919 746415334
2263 612836992
1369 629868215
1333 406822326
2529 638640051
2248 199983696
983 705596425
2369 905127765
593 507689114
2754 728980284
1220 46064176
191 675774304
899 860569059
189 34169207
2925 441527028
1586 429210755
414...

output:

345165088356

result:

ok single line: '345165088356'

Test #99:

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

input:

3000
2630 292601364
1114 33742065
2455 35087125
1634 996478615
2742 828156197
2565 197921984
475 426174077
2405 631098259
2805 57142735
131 457493107
146 548039354
2669 614222660
1764 799188357
2208 245392975
237 274835829
1352 49598180
1927 294595494
2348 126733492
1227 35818394
660 50939378
627 33...

output:

375065663425

result:

ok single line: '375065663425'

Test #100:

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

input:

3000
1651 43696822
2266 954917333
2058 923376581
1824 896016118
852 762413411
2867 930490625
866 369963586
2192 855374192
83 475645419
1012 567518871
2308 537965931
2970 323317556
1221 90687600
1662 761805666
2253 356123834
2512 275938407
2956 876105576
2794 219297778
1242 630109760
1019 820151648
2...

output:

346988601561

result:

ok single line: '346988601561'

Test #101:

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

input:

3000
1956 647308632
419 876092601
2945 664182389
2015 648069973
1961 844154274
170 663059265
2971 166269448
265 79650124
359 894148102
1894 825028282
2755 380408860
1556 32412452
678 529670491
1115 130734709
2983 584895488
674 649762283
2270 310132010
240 311862064
1258 76917478
93 589363918
1483 13...

output:

363685371523

result:

ok single line: '363685371523'

Test #102:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

3000
1342 920733383
934 68397807
1822 575657550
1840 186601359
2017 331123853
984 825979913
1329 298156668
1591 731429794
2106 717861612
2618 954831055
1603 221984324
242 428512674
1954 409057736
2515 268708105
1621 149421828
430 302230044
2433 578721141
2356 26141117
362 115679745
2495 838018201
18...

output:

0

result:

ok single line: '0'

Test #103:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

3000
356 426159740
1364 38777783
362 660098095
708 74620330
1646 305657038
1588 338072361
2102 328177109
2933 711153565
923 247864607
1118 435995124
2227 932469025
880 549607061
1 580469060
893 388159270
2586 395750085
399 82132844
1940 990549873
1164 826396273
1507 272901538
961 657770339
6 6709936...

output:

0

result:

ok single line: '0'

Test #104:

score: 0
Accepted
time: 0ms
memory: 3768kb

input:

3000
2827 931586096
2302 9157758
2667 744538639
976 815155654
2668 427673871
2037 997648458
726 505681198
2246 690877337
2514 777867601
425 917159194
182 495470079
1717 818185096
790 751880383
1702 507610434
1957 642078342
1678 862035644
921 254894957
821 479167780
2604 282639683
508 477522477
1185 ...

output:

0

result:

ok single line: '0'

Test #105:

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

input:

3000
145 437012453
1869 979537734
1813 828979184
2971 703174626
390 402207057
468 657224554
2585 535701638
1517 670601108
2370 160386948
852 250839615
2874 58471132
1140 939279483
1434 923291707
1851 627061599
1902 888406600
1695 494454796
1113 519240042
2546 131939288
1704 439861475
1389 297274615
...

output:

0

result:

ok single line: '0'

Test #106:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

3000
606 89922457
614 949917710
51 913419729
2015 443709949
632 524223890
847 169317003
2914 713205727
2602 650324879
25 690389943
713 732003685
2665 621472185
295 60373870
1425 94703030
287 746512763
2224 134734857
118 274357596
411 931068774
2152 784710795
2509 449599620
1817 117026753
2304 906382...

output:

0

result:

ok single line: '0'

Test #107:

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

input:

3000
161 606560503
1865 631063539
2738 505190904
2577 887315499
2100 492039055
943 515878855
470 589874021
1881 113782919
421 649765038
2850 563211570
1678 396434623
239 636026762
1828 637502617
51 685754406
2024 834644716
1216 782685848
448 880231364
1523 616437798
333 213102508
1105 894811376
2587...

output:

646300921703

result:

ok single line: '646300921703'

Test #108:

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

input:

3000
990 875624570
1150 959785010
207 289411951
1206 981166436
822 102644534
2238 9203765
516 686679548
38 546926934
2192 559872451
2065 69716747
1058 908969328
1104 121605545
1862 974389607
1088 72264244
409 396029334
2779 201980938
2 719365452
1922 895234839
867 764849542
525 595390911
1987 105290...

output:

657671642116

result:

ok single line: '657671642116'

Test #109:

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

input:

3000
2815 620058855
1979 736675690
2253 122727566
2637 707967171
2895 266398191
2935 690915622
587 957558591
2484 790142379
2886 340133219
1954 744799771
607 610490193
2319 655261504
1589 511088910
931 212605641
1302 436003593
151 63905636
1753 20071612
1438 460663102
1290 43246967
2451 767484662
10...

output:

646450708397

result:

ok single line: '646450708397'

Test #110:

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

input:

3000
611 635932758
2291 721056420
1482 980033133
1457 61793944
2283 950458899
654 382202362
322 567927250
2513 668038517
331 705681381
100 54756617
2049 522032493
2908 245077688
1649 497130813
2015 724270384
707 182426417
1021 984571339
227 705973828
2996 666451487
800 647282717
1624 823181575
889 4...

output:

655992863738

result:

ok single line: '655992863738'

Test #111:

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

input:

3000
1777 588349034
2166 904332059
2570 789304272
30 584026070
2707 1353763
289 644416298
2057 992298783
407 567552920
2919 189797808
1263 539316623
104 384876898
1610 851373337
512 641250014
1688 896340297
427 804219159
2734 925735201
723 948579484
2158 354283313
22 398541542
2232 584484908
2249 83...

output:

633926062519

result:

ok single line: '633926062519'

Test #112:

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

input:

3000
2283 608822472
2661 762930764
1581 570568414
2018 580095695
2650 367136635
441 341098741
2506 946053816
1970 516730034
982 260946648
189 555522440
55 274708222
353 546237285
140 102482028
1677 781668011
561 264896222
724 270275171
1327 649902076
1177 486242011
1753 471414365
2081 127216191
1251...

output:

447711958222

result:

ok single line: '447711958222'

Test #113:

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

input:

3000
2141 421691180
2384 222318327
1699 562634554
2995 516939704
2668 858689336
2737 51869849
2733 795530235
239 93570389
873 126265945
1626 67277719
2822 401643626
2823 698314536
1780 118899545
2627 993959653
447 291226251
1009 570793517
66 644708728
334 832366939
2239 225186937
966 924300230
33 63...

output:

451488317923

result:

ok single line: '451488317923'

Test #114:

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

input:

3000
1566 4
1335 2
2526 4
1806 2
2567 2
1030 4
2345 4
2453 2
1918 2
1617 4
2077 2
2868 2
456 4
1672 2
2382 4
761 4
2545 4
2973 2
699 2
1783 4
2654 2
496 4
1770 4
622 4
638 4
2284 2
2778 4
817 4
904 4
2181 4
1789 4
936 4
2609 2
2785 4
681 2
2149 4
2977 4
1661 2
2570 4
861 2
1723 2
13 2
805 2
591 2
18...

output:

3001

result:

ok single line: '3001'

Test #115:

score: 0
Accepted
time: 0ms
memory: 4048kb

input:

3000
2359 2
2282 2
2074 2
1945 4
400 2
1813 2
2999 2
617 2
2289 2
968 4
2614 2
2931 4
2993 2
192 4
504 4
803 2
2795 4
467 2
816 4
2592 4
368 2
225 2
268 4
1297 4
73 4
1436 4
547 2
749 4
136 4
318 4
2160 4
2152 2
2116 4
326 4
309 2
2094 4
1635 2
795 2
2869 2
1386 4
1287 2
441 4
1141 2
2255 2
484 4
19...

output:

3001

result:

ok single line: '3001'

Test #116:

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

input:

3000
2448 238810714
2264 744750825
2705 586455482
2259 337000342
1771 184424419
526 267809184
819 259639406
2361 836501520
2366 702445801
1327 286216315
2532 59858309
2888 25459278
1071 427164986
2233 773653738
936 476629197
1827 445365095
2091 820619598
2716 488990281
1602 656648262
415 340031267
9...

output:

424779056386

result:

ok single line: '424779056386'

Test #117:

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

input:

3000
143 126775487
2684 860254
984 550199553
1568 49107298
326 39744614
490 496767160
347 249173746
224 158245052
2673 45598488
2195 13064595
1091 302115152
815 356844430
826 560450372
2258 789676373
2883 966691924
1685 397495437
25 686211447
2735 706659201
1474 562967442
2985 644970123
2710 3695788...

output:

460592993010

result:

ok single line: '460592993010'

Test #118:

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

input:

3000
636 261274131
2398 612953436
1440 168159791
2856 25655575
881 746509097
1713 896650160
1396 663554454
2121 708771563
2871 508845108
2554 577508382
518 223810321
1354 38142121
523 32443088
2349 689735262
2138 159709742
394 96042630
594 394062004
894 860267110
1172 818003950
1456 658883600
439 60...

output:

798467

result:

ok single line: '798467'

Test #119:

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

input:

3000
1156 858042354
2933 896229664
239 236088038
1940 377229728
644 610364716
1855 127636393
1962 853427512
1445 122431481
1657 407932305
467 335369980
2944 780702343
1390 230002275
950 117307157
2996 406244931
2065 642413325
745 672946457
41 122204063
2546 237939620
2689 293001693
2671 474554544
20...

output:

738026

result:

ok single line: '738026'

Test #120:

score: 0
Accepted
time: 0ms
memory: 3936kb

input:

3000
47 2
884 2
954 2
1353 1
320 1
338 1
548 1
923 2
467 2
1508 2
1839 1
2976 1
219 1
591 1
156 2
1728 1
2531 1
2277 1
700 2
494 1
828 1
642 1
2807 2
1558 2
277 2
1870 2
530 2
962 2
2583 1
1433 1
2381 1
194 2
774 2
1424 1
42 2
2759 1
2665 2
1453 1
1937 2
1071 1
2522 2
1200 1
372 2
528 1
1626 2
1049 ...

output:

1405

result:

ok single line: '1405'

Test #121:

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

input:

3000
352 2
2035 2
1842 2
258 2
1428 1
640 1
939 1
710 1
743 2
2389 1
1002 2
1562 1
2675 2
45 2
2172 1
2889 1
561 2
1437 1
715 1
2567 2
2755 2
1084 1
2508 1
1188 1
1847 1
2063 2
819 1
2011 1
59 2
2524 2
1125 1
117 2
702 2
2017 2
1191 2
660 2
212 2
2944 1
129 1
2974 2
1917 2
1745 1
1237 2
96 1
1995 1
...

output:

1389

result:

ok single line: '1389'

Test #122:

score: 0
Accepted
time: 0ms
memory: 4044kb

input:

3000
2371 2
188 2
1444 2
449 1
2537 2
942 1
45 2
1782 1
1019 2
272 2
164 1
1862 1
2133 1
2498 1
1189 1
1050 1
1589 2
1882 1
731 1
1641 2
1684 1
2811 1
2209 2
2102 1
418 1
2256 2
2823 1
62 2
535 1
616 2
1583 2
40 1
630 1
1324 1
625 1
275 2
759 2
150 1
2606 1
1878 2
28 2
577 2
2103 2
2663 1
650 1
241 ...

output:

1356

result:

ok single line: '1356'

Test #123:

score: 0
Accepted
time: 0ms
memory: 3980kb

input:

3000
2677 1
1340 2
2331 2
640 1
2361 1
1244 3
436 1
2854 1
1295 3
1153 2
612 3
448 2
1590 1
1952 3
205 1
925 3
904 1
2328 2
2032 3
715 1
1897 3
254 1
1910 1
17 3
1988 3
735 1
1828 1
1111 3
1010 1
422 2
327 2
1676 1
558 3
632 3
60 2
1176 3
2590 3
1641 1
799 2
2496 1
1137 3
2408 1
2968 3
947 3
1019 1
...

output:

1844

result:

ok single line: '1844'

Test #124:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

3000
2982 2
2492 3
220 2
830 3
470 1
2831 2
2541 3
2641 1
1571 2
2035 2
2774 2
749 1
1047 1
1405 2
936 1
2086 2
1932 3
2773 2
2048 2
2788 2
825 2
1981 2
1610 3
932 1
559 2
929 2
2117 2
2160 3
1486 1
1514 3
785 1
1599 3
1771 1
1224 1
2493 1
791 3
138 2
133 2
277 3
1399 1
2247 1
2953 3
834 2
515 2
138...

output:

1768

result:

ok single line: '1768'

Test #125:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

3000
288 3
1930 3
1107 2
1021 2
1579 3
135 2
2932 3
713 3
562 1
1632 1
222 2
1049 1
2218 3
859 1
2952 2
247 1
2961 2
1933 1
2063 2
1862 3
2753 2
2423 2
1311 1
561 2
2129 3
1122 3
1122 3
210 2
1961 1
1320 1
2528 2
1522 3
1699 3
532 3
643 3
1692 1
684 2
1623 3
2753 1
303 1
357 2
1785 3
415 2
83 2
1758...

output:

1818

result:

ok single line: '1818'

Test #126:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

3000
2307 4
83 3
1994 5
1211 4
2687 4
437 3
2038 4
1785 3
839 4
2513 3
2384 4
2634 5
1675 4
2027 2
1969 5
1408 4
2275 5
2379 5
2079 2
936 3
1681 4
1151 4
1012 3
1476 2
701 2
2600 4
127 5
1260 1
2437 1
2411 1
2987 1
1445 5
1627 2
2838 4
77 5
2592 5
2516 2
115 5
946 2
2206 2
2751 2
616 1
1280 3
1366 1...

output:

2579

result:

ok single line: '2579'

Test #127:

score: 0
Accepted
time: 0ms
memory: 3976kb

input:

3000
2613 2
1235 5
2882 3
1402 4
2511 2
739 3
1144 3
1572 1
1115 3
396 2
1547 3
2935 1
1132 1
1480 3
986 3
2568 5
305 2
2824 5
381 4
10 5
1894 1
1593 5
1997 1
2390 5
2271 3
2794 2
417 1
2309 2
2912 2
503 2
1731 3
1368 1
1555 2
2145 5
2511 5
2207 1
63 2
321 2
424 2
1109 5
862 2
2447 3
2146 1
934 1
78...

output:

2523

result:

ok single line: '2523'

Test #128:

score: 0
Accepted
time: 0ms
memory: 3916kb

input:

3000
2918 2
2387 3
2484 1
1593 2
621 1
2326 3
1535 3
2644 4
1391 4
1277 3
1994 5
236 2
589 2
934 4
1717 3
730 3
1334 1
270 1
397 5
2083 1
823 4
321 3
1698 5
306 3
842 2
2987 4
2420 2
359 2
389 1
310 3
2189 1
6 5
2768 5
2738 3
1946 5
109 2
610 1
1811 5
2901 1
1727 2
1971 2
2993 4
12 4
503 2
1151 3
12...

output:

2613

result:

ok single line: '2613'

Test #129:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

3000
2915 2
172 2
121 2
2631 2
2478 2
1647 2
323 2
997 2
2358 2
2591 2
971 2
1096 2
1560 2
2080 2
1633 2
463 2
2777 2
176 2
2271 2
407 2
1789 2
676 2
2578 2
1548 2
391 2
1316 2
355 2
200 2
1582 2
275 2
1847 2
1932 2
1999 2
1675 2
1137 2
713 2
2573 2
826 2
937 2
104 2
361 2
2132 2
1475 2
2187 2
694 2...

output:

2

result:

ok single line: '2'

Test #130:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

3000
608 2
2978 2
806 2
2190 2
1783 2
1690 2
953 2
2105 2
1562 2
1876 2
2528 2
2543 2
2991 2
1742 2
2985 2
1144 2
2036 2
1959 2
2351 2
513 2
1203 2
654 2
198 2
684 2
164 2
930 2
2603 2
2815 2
2304 2
1294 2
1654 2
2805 2
1015 2
1043 2
476 2
398 2
2627 2
2207 2
2831 2
1962 2
2225 2
493 2
329 2
841 2
2...

output:

2

result:

ok single line: '2'

Test #131:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

3000
2577 3
1574 3
2527 3
1216 3
2179 3
1896 3
2801 3
1361 3
419 3
2501 3
357 3
747 3
1204 3
321 3
1588 3
894 3
48 3
1389 3
514 3
1009 3
1112 3
1354 3
888 3
1526 3
1467 3
1271 3
1781 3
318 3
834 3
2266 3
2676 3
2140 3
2807 3
2978 3
358 3
506 3
2857 3
700 3
603 3
217 3
1114 3
1325 3
2018 3
1391 3
807...

output:

2

result:

ok single line: '2'

Test #132:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

3000
2000 3
1948 3
424 3
2007 3
839 3
1293 3
1024 3
188 3
2032 3
1004 3
2917 3
2290 3
699 3
2751 3
195 3
1746 3
2964 3
2412 3
2556 3
1339 3
1212 3
1498 3
2766 3
2921 3
2963 3
792 3
2908 3
181 3
735 3
1935 3
2324 3
1842 3
880 3
2337 3
2385 3
2511 3
2084 3
2268 3
268 3
1468 3
2660 3
1944 3
920 3
2945 ...

output:

2

result:

ok single line: '2'

Test #133:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

3000
333 584663352
333 606076778
333 751160915
333 7877084
333 197873763
333 885376725
333 533647082
333 749300466
333 396188331
333 317895657
333 579222828
333 762079510
333 474920603
333 714531567
333 758216644
333 403893800
333 725685531
333 639633212
333 307851938
333 937333931
333 95995200
333 ...

output:

1390250513358

result:

ok single line: '1390250513358'

Test #134:

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

input:

3000
618 273227240
618 215679963
618 124052949
618 799285352
618 810287517
618 324389195
618 513291051
618 262180422
618 439434039
618 797734569
618 525642494
618 748943444
618 108187488
618 763739254
618 861597670
618 467203766
618 549221942
618 505882319
618 331792115
618 651361
618 4806591
618 32...

output:

1413804576761

result:

ok single line: '1413804576761'

Test #135:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

3000
164 309257468
527 945286785
2019 588492801
100 354103812
2070 430028889
80 816894026
2911 649391999
1948 606162835
2027 615445311
853 814342845
1454 202354251
1515 68699170
399 865845407
1845 130028849
795 857810607
1683 442810454
1411 646813216
2018 321574896
446 321174766
2123 653193480
1655 ...

output:

756733945

result:

ok single line: '756733945'

Test #136:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

3000
2925 620537115
958 177330972
285 225617682
2742 24847026
1525 658886335
1963 295391077
1376 227714902
114 933190506
1186 388961666
2224 452303667
2021 932172067
2688 27465544
344 99960090
1329 512838869
920 604013597
2226 874218903
206 244621429
475 260186114
924 37944102
2785 145186627
1580 23...

output:

913012266

result:

ok single line: '913012266'

Test #137:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

1812
1069 73822429
1219 696182050
1419 415286834
1172 921421058
386 141356482
887 467763210
1622 910711766
707 745035435
789 504763888
165 991731626
626 125408265
269 204040651
1029 973971236
1803 834302
355 609625456
756 697859308
837 371281177
1162 425996063
44 632808297
815 348688763
719 15147677...

output:

206816500546

result:

ok single line: '206816500546'

Test #138:

score: 0
Accepted
time: 0ms
memory: 3896kb

input:

832
127 258660948
95 317460220
275 307161079
419 306951059
282 624381722
488 329784054
193 182903522
752 364123724
808 117075043
516 775000611
446 896676390
478 785214763
128 601419915
717 671754874
145 572975838
282 240941424
763 793779188
438 884819087
584 676358849
301 969627642
31 195748183
77 1...

output:

96514369941

result:

ok single line: '96514369941'

Test #139:

score: 0
Accepted
time: 0ms
memory: 3944kb

input:

1137
308 443499466
1136 86222039
200 199035324
600 692481060
203 107406962
648 339288546
139 602578926
1112 983212013
121 729386198
54 410785949
1125 667944515
799 366388875
83 228868593
840 195191798
952 536326219
607 931507187
249 216277198
707 343642111
446 719909401
685 590566522
804 387503241
6...

output:

131099708058

result:

ok single line: '131099708058'

Test #140:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

1443
1256 628337985
938 707500209
994 90909568
565 78011060
1102 590432202
626 201309390
898 874770682
835 602300302
1259 341697352
1219 194054935
146 291728992
232 95046635
852 856317272
742 718628721
668 499676600
799 622072951
383 786258856
1057 802465135
397 763459953
395 64021753
455 431774651
...

output:

173631335532

result:

ok single line: '173631335532'

Test #141:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

1748
101 813176504
838 328778380
10 130267461
435 611024709
729 73457443
1081 210813882
435 146962438
531 221388592
38 101492155
128 977323920
771 62997118
134 676220747
473 483765951
234 242065645
798 463026982
922 165155066
1111 208756867
927 113804511
1501 807010505
1535 684960633
1665 623529709
...

output:

198089294433

result:

ok single line: '198089294433'

Test #142:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

768
63 845702081
337 710055971
439 761466736
744 858359184
274 348436051
441 953359474
122 564891584
418 336270233
516 562244425
279 171626005
244 677660274
297 9196837
300 56345024
243 418335260
146 421237933
312 618073616
575 224463326
743 928574868
653 794760065
478 671676985
124 415389347
108 15...

output:

0

result:

ok single line: '0'

Test #143:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

1074
444 415412470
185 339137781
951 251053955
293 707699572
680 45415925
412 798392460
825 646987055
128 7223607
616 55266716
527 147988257
655 848144206
70 477977205
125 929601110
48 202034464
564 785956658
333 31074911
196 830309894
418 109849481
587 452974508
607 729202198
3 322558942
830 574672...

output:

0

result:

ok single line: '0'

Test #144:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

1379
559 102544980
1032 130516516
163 711852318
1348 709667268
1099 941077047
148 292550778
299 519351307
193 939399709
612 126343844
1374 390226968
1130 112011253
135 704191761
1135 778887110
920 72270631
554 700710969
9 751792135
361 9574277
1277 757583237
424 381683140
931 890173768
421 349610277...

output:

0

result:

ok single line: '0'

Subtask #4:

score: 30
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #145:

score: 30
Accepted
time: 7ms
memory: 5744kb

input:

100000
80751 85377744
28965 191391530
77827 553475509
54206 344887257
24561 812158120
1189 880268352
91741 686078706
75166 182546394
37822 220137367
51969 89957933
45650 715669848
52842 196032869
14753 68706224
56986 212567593
7000 964776170
35833 301950428
36116 426542625
49126 941604921
41949 9947...

output:

11896567562847

result:

ok single line: '11896567562847'

Test #146:

score: 0
Accepted
time: 7ms
memory: 5736kb

input:

100000
56379 688989554
69332 112566798
52210 294281317
27370 96941112
48417 746415334
31259 612836992
1206 629868215
59644 406822326
22302 638640051
59246 199983696
17346 705596425
23557 905127765
84676 507689114
1940 728980284
39158 46064176
85847 675774304
3663 860569059
41361 34169207
69561 44152...

output:

11908310620051

result:

ok single line: '11908310620051'

Test #147:

score: 0
Accepted
time: 3ms
memory: 5812kb

input:

100000
32007 292601364
9700 33742065
26593 35087125
534 996478615
77395 828156197
61329 197921984
15793 426174077
44122 631098259
6782 57142735
66524 457493107
94164 548039354
99394 614222660
59723 799188357
46893 245392975
71316 274835829
35863 49598180
76331 294595494
38719 126733492
92050 3581839...

output:

11943834117254

result:

ok single line: '11943834117254'

Test #148:

score: 0
Accepted
time: 7ms
memory: 5804kb

input:

100000
12759 43696822
50067 954917333
6100 923376581
73696 896016118
1252 762413411
91399 930490625
25257 369963586
33723 855374192
91262 475645419
73801 567518871
70983 537965931
75233 323317556
29647 90687600
91846 761805666
3475 356123834
85877 275938407
49001 876105576
30955 219297778
19662 6301...

output:

11944425001324

result:

ok single line: '11944425001324'

Test #149:

score: 0
Accepted
time: 7ms
memory: 5788kb

input:

100000
88386 647308632
90434 876092601
80482 664182389
46860 648069973
25108 844154274
21470 663059265
39844 166269448
18201 79650124
75742 894148102
81079 825028282
42678 380408860
45948 32412452
99570 529670491
36799 130734709
40755 584895488
35893 649762283
16547 310132010
23190 311862064
47274 7...

output:

11920944551521

result:

ok single line: '11920944551521'

Test #150:

score: 0
Accepted
time: 7ms
memory: 4708kb

input:

100000
77134 338666772
91817 595987193
47322 193553138
54524 622902988
34240 584637928
64643 874415691
40064 49831786
90735 167513636
63852 508479946
42269 7221127
71681 580224925
13505 615160129
62734 722256728
51472 872429594
40560 18093042
15853 739082213
20935 24415875
85428 773933132
31109 2431...

output:

0

result:

ok single line: '0'

Test #151:

score: 0
Accepted
time: 7ms
memory: 4904kb

input:

100000
84602 243990183
86179 486234947
28926 559601199
18780 73243171
62297 330640864
42005 426875648
18181 64031708
25168 914788428
3973 737197874
33199 756362322
48685 868354122
71862 669843053
52446 143589206
52214 223988195
77610 31980648
89508 914583706
36906 502394848
36019 581340603
46278 788...

output:

0

result:

ok single line: '0'

Test #152:

score: 0
Accepted
time: 3ms
memory: 4888kb

input:

100000
33648 149313594
56427 523966350
25943 73132908
88404 523583354
92461 224127448
67321 126819253
97707 78231629
76778 514579571
15596 818432153
65653 358019869
4543 156483318
81672 872009624
398 712405331
32752 575546796
63029 898384606
51517 90085199
32330 980373820
55342 536231721
16856 55177...

output:

0

result:

ok single line: '0'

Test #153:

score: 0
Accepted
time: 7ms
memory: 4844kb

input:

100000
47118 54637004
58848 414214105
72370 439180969
47794 973923538
1874 117614032
43857 679279210
18763 92431550
67095 261854363
63049 47150081
75106 107161065
70166 592096163
72855 926692548
64167 133737809
20980 74589044
29926 764788564
72082 118103045
80268 458352792
41621 343639192
67554 3155...

output:

0

result:

ok single line: '0'

Test #154:

score: 0
Accepted
time: 7ms
memory: 4824kb

input:

100000
23316 959960415
85563 451945508
38311 805229030
54610 276780073
75526 863616969
63183 231739166
52275 106631471
19651 9129155
64053 128384360
20752 856302260
64840 880225360
43189 128859119
35543 555070286
70574 426147645
69455 631192522
56877 293604538
30862 83815413
78794 298530310
11294 79...

output:

0

result:

ok single line: '0'

Test #155:

score: 0
Accepted
time: 4ms
memory: 5800kb

input:

100000
98873 629947769
94962 375991048
65956 335766122
51581 867366794
81848 999439514
33528 887102590
43237 969204833
3860 750805383
91285 61390746
10260 594117007
6872 999330762
17302 502130639
67488 601073918
96906 45552863
44790 978789796
1171 914743911
30524 944502606
25970 523471975
6397 96010...

output:

21452310291289

result:

ok single line: '21452310291289'

Test #156:

score: 0
Accepted
time: 4ms
memory: 5820kb

input:

100000
25612 463415602
11059 162699182
10790 574498996
28872 964183215
39152 629546900
48315 437186758
22741 531351268
9821 696910393
34650 256453998
50777 672441468
25795 86335328
81051 936864924
24168 982356962
91807 49220582
75968 777613718
38539 371243328
13027 855159809
27915 505601391
63329 70...

output:

21402613106405

result:

ok single line: '21402613106405'

Test #157:

score: 0
Accepted
time: 9ms
memory: 5788kb

input:

100000
53227 894258422
48033 957111971
37441 425134220
90881 446386219
19047 116304308
94131 501487127
57810 176264525
5679 653198794
50226 330209581
13018 739965275
10919 198531948
63903 253407037
29286 690366072
81056 722173293
91454 714260155
47052 563020937
90520 577950049
7933 90392249
55216 34...

output:

21494133153427

result:

ok single line: '21494133153427'

Test #158:

score: 0
Accepted
time: 8ms
memory: 5820kb

input:

100000
80001 624928205
67723 736037187
26388 613897815
31808 604102286
72518 113739314
82961 678701731
70420 70585200
42786 753528067
18387 964502067
84908 974756347
14851 880515971
47789 235022390
41408 758670290
84453 988773011
26182 567513566
6508 519148472
2319 835222672
19367 117472831
59525 87...

output:

21504583632620

result:

ok single line: '21504583632620'

Test #159:

score: 0
Accepted
time: 8ms
memory: 5804kb

input:

100000
91337 609283047
50921 920958897
24784 306884668
65027 550947132
18511 870242492
72928 201585146
43748 693663477
60318 337880250
70680 277072567
22133 225775156
44109 370464941
12734 812812020
76513 288798830
67652 598359695
34736 544568940
20448 884471479
24024 654126816
96053 707248889
28661...

output:

21496060666540

result:

ok single line: '21496060666540'

Test #160:

score: 0
Accepted
time: 6ms
memory: 5800kb

input:

100000
98927 394953501
88007 641775965
72029 793487091
70799 477514077
51598 804062402
9076 288578050
40475 160864379
50392 952727352
16808 295064700
16124 726313626
3864 53115206
50610 921448115
18161 763347742
67472 750173737
74927 437139323
64876 83345973
83280 312170113
46038 515453116
72064 549...

output:

14899717303166

result:

ok single line: '14899717303166'

Test #161:

score: 0
Accepted
time: 5ms
memory: 5864kb

input:

100000
23662 48436002
77292 12470695
98740 661442028
77890 733595248
5651 660077068
60921 849605509
64526 344097625
82128 146847103
51059 524060228
88871 142275315
89242 441381907
45478 877604839
10316 661780539
12482 577353874
37757 339572669
70509 865631265
74107 5121090
19069 721051108
70525 5916...

output:

14753257710158

result:

ok single line: '14753257710158'

Test #162:

score: 0
Accepted
time: 6ms
memory: 5924kb

input:

100000
71784 4
49511 4
36932 2
60870 2
97447 4
70636 2
11008 4
66485 4
41668 4
78639 4
88391 4
5727 4
36301 2
14434 2
93800 4
33904 2
80798 2
12454 2
9189 4
47189 4
2500 4
75091 2
1015 4
30392 2
72147 4
57746 2
63477 4
82709 4
96472 2
55203 2
16786 4
5604 2
77918 4
59830 2
78992 4
879 2
81142 4
3846...

output:

100001

result:

ok single line: '100001'

Test #163:

score: 0
Accepted
time: 6ms
memory: 5812kb

input:

100000
83457 2
68076 4
88625 4
51361 4
16316 2
36680 4
91983 2
70749 4
53782 2
44305 4
59727 2
53665 4
44105 4
15770 4
33327 2
43653 2
66643 4
80714 2
88537 4
73404 2
472 2
95644 4
32358 4
39252 4
688 4
18192 4
47457 4
91051 2
11432 4
71864 4
38070 4
20275 2
86353 4
74403 4
61531 2
74996 4
82044 2
3...

output:

100001

result:

ok single line: '100001'

Test #164:

score: 0
Accepted
time: 7ms
memory: 5428kb

input:

100000
2447 942582671
84990 275592135
5692 512617135
41222 661384649
42572 398299968
10922 510075047
83936 336730819
64292 333200278
18935 582032770
60127 40577395
10696 637564412
12914 749345190
96716 807359392
58662 971693628
88163 503303110
75957 299785095
89252 381071618
17009 196120738
12117 74...

output:

14890090557084

result:

ok single line: '14890090557084'

Test #165:

score: 0
Accepted
time: 7ms
memory: 5436kb

input:

100000
57164 961175669
40210 608582733
35645 128383068
39978 161564397
52111 975633704
56995 342844274
43491 121257084
51443 914827739
65261 649511736
85832 506262885
54907 831922610
86089 559685606
34974 214287395
66672 634765656
23756 210456401
97511 839533614
84698 98737745
33814 139972098
38219 ...

output:

14991848974764

result:

ok single line: '14991848974764'

Test #166:

score: 0
Accepted
time: 8ms
memory: 5404kb

input:

100000
77049 78477171
62754 569727759
84876 194003412
15972 538103993
93298 4506871
78319 201254319
69550 594006316
18125 975311145
5194 41304808
35215 366195552
17035 659471345
86175 257555174
14486 110060387
73932 223014600
23787 438479139
1478 36627318
39438 841916244
66221 692999876
3076 7651741...

output:

66752

result:

ok single line: '66752'

Test #167:

score: 0
Accepted
time: 8ms
memory: 5408kb

input:

100000
62922 845275564
31312 177029613
16436 918270101
10706 237861406
24074 529803450
41679 564927665
69059 101308385
87291 451440171
54142 645070743
79151 563955528
98990 207729440
30939 762307097
5816 890713813
15522 813021393
94744 430880814
5724 783490025
85193 291416547
82259 515785927
711 115...

output:

22001

result:

ok single line: '22001'

Test #168:

score: 0
Accepted
time: 0ms
memory: 5820kb

input:

100000
56058 2
47168 2
9130 2
42087 1
9108 1
67191 1
70891 1
54014 2
1356 2
39847 2
66367 1
56133 1
48616 1
11402 1
72252 2
86175 1
66524 1
1276 1
51411 2
57836 1
51355 1
95809 1
65971 2
69943 2
13171 2
94463 2
75642 2
22471 2
20843 1
88484 1
41443 1
23576 2
41237 2
64564 1
39683 2
46419 1
90094 2
2...

output:

47676

result:

ok single line: '47676'

Test #169:

score: 0
Accepted
time: 0ms
memory: 5800kb

input:

100000
31686 2
87534 2
83513 2
20373 2
32963 1
97261 1
80355 1
43615 1
85835 2
47124 1
43186 2
26848 1
18540 2
56355 2
4411 1
36191 1
39194 2
98633 1
79022 1
8824 2
96443 2
62785 1
53552 1
16420 1
51568 1
55015 2
76662 1
94560 1
27403 2
92418 2
78435 1
73974 2
95028 2
13969 2
9762 2
9981 2
35379 2
9...

output:

47291

result:

ok single line: '47291'

Test #170:

score: 0
Accepted
time: 2ms
memory: 5732kb

input:

100000
12437 2
27902 2
63019 2
93536 1
56819 2
27332 1
94942 2
28093 1
70315 2
54402 2
20004 1
2686 1
88464 1
1309 1
36569 1
86205 1
11863 2
90868 1
6635 1
59811 2
41533 1
24638 1
41133 2
57772 1
89965 1
15567 2
82806 1
66651 2
33964 1
96352 2
20551 2
24373 1
48820 1
68495 1
74716 1
78665 2
80664 2
...

output:

47698

result:

ok single line: '47698'

Test #171:

score: 0
Accepted
time: 2ms
memory: 5752kb

input:

100000
88065 1
68269 2
37402 2
66700 1
85798 1
57402 3
4407 1
12571 1
54795 3
61679 2
91699 3
73400 2
58388 1
46262 3
68726 1
41343 3
79409 1
83104 2
29124 3
10799 1
81498 3
91613 1
28714 1
99124 3
28363 3
70995 1
88950 1
38741 3
40524 1
5410 2
57543 2
79893 1
2612 3
23023 3
39672 2
42228 3
20826 3
...

output:

59577

result:

ok single line: '59577'

Test #172:

score: 0
Accepted
time: 5ms
memory: 5820kb

input:

100000
63693 2
8637 3
11786 2
39863 3
9654 1
82349 2
18994 3
2172 1
39275 2
68957 2
68518 2
49239 1
28312 1
91214 2
6008 1
91358 2
52078 3
75339 2
56736 2
61786 2
26587 2
53466 2
16294 3
40478 1
66760 2
31548 2
89970 2
10831 3
47085 1
9345 3
99658 1
30292 3
51280 1
72426 1
4627 1
10913 3
66111 2
198...

output:

59330

result:

ok single line: '59330'

Test #173:

score: 0
Accepted
time: 5ms
memory: 5812kb

input:

100000
39321 3
43881 3
86168 2
13027 2
33510 3
12421 2
28458 3
86648 3
28878 1
81358 1
40213 2
25077 1
3359 3
36168 1
38166 2
41373 1
24748 2
72697 1
84347 2
12774 3
71676 2
20442 2
3875 1
86953 2
5158 3
92099 3
96114 3
82920 2
53645 1
18402 1
36651 2
80690 3
5072 3
26954 3
74705 3
74475 1
11396 2
9...

output:

59671

result:

ok single line: '59671'

Test #174:

score: 0
Accepted
time: 5ms
memory: 5788kb

input:

100000
20072 4
84248 3
60551 5
86189 4
57365 4
42491 3
43045 4
71126 3
13359 4
88635 3
17032 4
95791 5
73282 4
86244 2
70324 5
91388 4
92293 5
64933 5
11960 2
63761 3
16765 4
82294 4
91455 3
28307 2
43556 2
47528 4
2259 5
55011 1
60206 1
22336 1
78767 1
31089 5
58863 2
81480 4
39660 5
38037 5
51558 ...

output:

85505

result:

ok single line: '85505'

Test #175:

score: 0
Accepted
time: 2ms
memory: 5820kb

input:

100000
95700 2
24616 5
34935 3
59353 4
86344 2
72561 3
57632 3
60727 1
97838 3
95913 2
93850 3
71630 1
43206 1
31197 3
2483 3
41403 5
64963 2
57168 5
34449 4
14749 5
56730 1
49270 5
73912 1
69659 5
81953 3
8081 2
3280 1
27101 2
66766 2
26270 2
15760 3
81487 1
12655 2
36007 5
4616 5
6722 1
96842 2
41...

output:

85621

result:

ok single line: '85621'

Test #176:

score: 0
Accepted
time: 0ms
memory: 5884kb

input:

100000
71328 2
64983 3
14441 1
32517 2
10201 1
97508 3
67096 3
45205 4
82318 4
3191 3
65545 5
47468 2
13130 2
76150 4
39764 3
91418 3
37633 1
49403 1
62061 5
65736 1
1820 4
11123 3
61493 5
11013 3
20351 2
68632 4
9423 2
99190 2
73327 1
35328 3
57875 1
37009 5
61323 5
85411 3
69571 5
70284 2
42128 1
...

output:

86188

result:

ok single line: '86188'

Test #177:

score: 0
Accepted
time: 6ms
memory: 5348kb

input:

100000
84709 2
36086 2
33371 2
36748 2
4347 2
66117 2
4664 2
76254 2
38060 2
34464 2
18004 2
14703 2
72395 2
88971 2
42173 2
25263 2
79396 2
92013 2
17573 2
54093 2
20371 2
46163 2
85018 2
97408 2
32590 2
34214 2
7896 2
24215 2
89402 2
80469 2
34836 2
11995 2
9367 2
93267 2
37436 2
33629 2
6837 2
67...

output:

2

result:

ok single line: '2'

Test #178:

score: 0
Accepted
time: 6ms
memory: 5400kb

input:

100000
26520 2
23738 2
38001 2
14631 2
48282 2
4853 2
72556 2
75270 2
80880 2
39974 2
618 2
17295 2
9492 2
10017 2
46201 2
99852 2
96135 2
95145 2
15468 2
36377 2
81706 2
26615 2
31445 2
91717 2
4125 2
7520 2
49985 2
59194 2
97242 2
77399 2
54447 2
86905 2
98380 2
24171 2
92786 2
48531 2
64513 2
513...

output:

2

result:

ok single line: '2'

Test #179:

score: 0
Accepted
time: 6ms
memory: 5412kb

input:

100000
17246 3
31587 3
65560 3
76274 3
50432 3
53498 3
50649 3
79123 3
14688 3
94678 3
36755 3
4290 3
82833 3
46002 3
76646 3
73173 3
94588 3
25058 3
79406 3
9183 3
22226 3
63883 3
4300 3
69595 3
95659 3
9404 3
78987 3
40241 3
42064 3
39837 3
19814 3
81687 3
70542 3
12704 3
96637 3
47183 3
96891 3
8...

output:

2

result:

ok single line: '2'

Test #180:

score: 0
Accepted
time: 6ms
memory: 5436kb

input:

100000
70810 3
23475 3
4482 3
7118 3
73683 3
72285 3
68452 3
5125 3
84709 3
89276 3
19066 3
89415 3
33025 3
97735 3
36371 3
2535 3
56650 3
77180 3
51210 3
12508 3
62380 3
88392 3
65727 3
3237 3
9558 3
3365 3
97387 3
65343 3
43335 3
61998 3
13302 3
29244 3
74874 3
21002 3
59921 3
19597 3
81697 3
1629...

output:

2

result:

ok single line: '2'

Test #181:

score: 0
Accepted
time: 3ms
memory: 5028kb

input:

100000
48333 142312722
48333 107230353
48333 369228578
48333 880218055
48333 578448017
48333 424203680
48333 984527897
48333 393494482
48333 128805310
48333 642105657
48333 447944325
48333 58624269
48333 574521172
48333 334720998
48333 542922423
48333 30274525
48333 355396802
48333 446188565
48333 4...

output:

46997760956161

result:

ok single line: '46997760956161'

Test #182:

score: 0
Accepted
time: 6ms
memory: 4972kb

input:

100000
30618 536243291
30618 964022374
30618 983572333
30618 414908856
30618 245273930
30618 671217808
30618 953731286
30618 664781850
30618 424947091
30618 125570124
30618 44995137
30618 293887292
30618 439835709
30618 134365988
30618 500570103
30618 274870273
30618 617662366
30618 349129217
30618 ...

output:

47132455574594

result:

ok single line: '47132455574594'

Test #183:

score: 0
Accepted
time: 8ms
memory: 5536kb

input:

100000
25249 815445942
19886 726436303
70322 255786590
18391 122094604
42562 325424172
74806 865343026
57345 612417227
40759 450268186
79743 313109448
74170 2608689
48008 5060343
70925 737600244
1017 890090121
38702 690442381
26708 899286673
56903 790626488
36540 247537234
45853 218464085
68813 1458...

output:

734009444

result:

ok single line: '734009444'

Test #184:

score: 0
Accepted
time: 4ms
memory: 5428kb

input:

100000
91627 514483285
31777 381218920
35879 772679098
79453 681915468
44197 98638942
26580 733566564
14121 110410203
34080 701610629
96354 984711273
39467 578364596
46928 766378765
55677 261138905
41635 447354557
46716 410824841
66090 821393125
54602 917031406
25294 314973502
13737 8510697
43029 54...

output:

712051959

result:

ok single line: '712051959'

Test #185:

score: 0
Accepted
time: 2ms
memory: 5112kb

input:

67351
42130 73822429
67231 696182050
26971 415286834
54669 921421058
20712 141356482
43638 467763210
51372 910711766
64303 745035435
32786 504763888
3329 991731626
4967 125408265
31393 204040651
51206 973971236
13552 834302
44698 609625456
50078 697859308
40869 371281177
66648 425996063
33910 632808...

output:

8095008842969

result:

ok single line: '8095008842969'

Test #186:

score: 0
Accepted
time: 4ms
memory: 4820kb

input:

48102
15682 258660948
36424 317460220
41878 307161079
6042 306951059
25808 624381722
1040 329784054
33025 182903522
30656 364123724
28687 117075043
37304 775000611
27392 896676390
40608 785214763
28194 601419915
37606 671754874
14764 572975838
15916 240941424
42817 793779188
13750 884819087
36945 67...

output:

5777157881171

result:

ok single line: '5777157881171'

Test #187:

score: 0
Accepted
time: 2ms
memory: 4392kb

input:

23730
1430 443499466
22635 86222039
15864 199035324
20826 692481060
17137 107406962
15185 339288546
10843 602578926
16744 983212013
23512 729386198
2664 410785949
2012 667944515
4051 366388875
8635 228868593
13323 195191798
14003 536326219
19996 931507187
232 216277198
7997 343642111
7989 719909401
...

output:

2782866932339

result:

ok single line: '2782866932339'

Test #188:

score: 0
Accepted
time: 8ms
memory: 5860kb

input:

99358
53370 628337985
65204 707500209
84848 90909568
61844 78011060
79153 590432202
55045 201309390
59118 874770682
78393 602300302
86864 341697352
21896 194054935
93109 291728992
88181 95046635
76635 856317272
82113 718628721
9370 499676600
79118 622072951
7157 786258856
58592 802465135
59746 76345...

output:

11973467072216

result:

ok single line: '11973467072216'

Test #189:

score: 0
Accepted
time: 0ms
memory: 5392kb

input:

74986
6433 813176504
74279 328778380
14797 130267461
47551 611024709
60484 73457443
14041 210813882
9994 146962438
45034 221388592
52198 101492155
14360 977323920
30879 62997118
66434 676220747
74040 483765951
6554 242065645
56485 463026982
70858 165155066
30058 208756867
60100 113804511
22232 80701...

output:

8887057861747

result:

ok single line: '8887057861747'

Test #190:

score: 0
Accepted
time: 4ms
memory: 4324kb

input:

55737
27625 973358782
11932 486774046
45220 612582779
4542 111406923
34590 16529981
43471 990248347
38333 594062304
51251 269110175
16107 332884102
27921 109823096
52736 4281366
22298 77217226
27965 100457300
23798 308864686
48184 964616060
34293 339701670
44003 489614671
22176 478895587
54153 22795...

output:

0

result:

ok single line: '0'

Test #191:

score: 0
Accepted
time: 2ms
memory: 3968kb

input:

31366
27659 278201063
11610 13581916
10388 892259036
14699 584100537
30212 247519860
19922 672835404
12368 463901108
23763 595337800
30414 227081691
24142 337215987
5842 919488490
29820 470106287
7368 245193529
23194 908201899
12106 373655877
23710 899524300
13030 676193808
2042 542186553
3107 30885...

output:

0

result:

ok single line: '0'

Test #192:

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

input:

6994
2072 347217529
1783 780926621
6387 939399267
2124 950646437
2558 288195694
5440 147820295
1661 853887651
1503 336011994
6955 775242453
3887 955768370
1133 264552701
5528 50121364
332 248827430
5274 42717408
915 385642370
4230 891853791
3648 742672096
6020 321044038
2324 854193246
58 179924101
1...

output:

0

result:

ok single line: '0'

Extra Test:

score: 0
Extra Test Passed