QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#372256#2281. BnPCkevinyang#AC ✓148ms20136kbC++171.3kb2024-03-31 07:54:292024-03-31 07:54:30

Judging History

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

  • [2024-03-31 07:54:30]
  • 评测
  • 测评结果:AC
  • 用时:148ms
  • 内存:20136kb
  • [2024-03-31 07:54:29]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int n,k;
	cin >> n >> k;
	map<string,int>hm;
	int cur = 0;
	vector<vector<int>>vals(200005);
	vector<int>arr(200005);
	for(int i = 1; i<=n; i++){
		string s;
		cin >> s;
		int v;
		cin >> v;
		if(!hm.count(s)){
			cur++; hm[s] = cur;
		}
		arr[hm[s]] = v;
	}
	int m;
	cin >> m;
	for(int i = 1; i<=m; i++){
		string s;
		cin >> s;
		int v;
		cin >> v;
		assert(hm[s]);
		vals[hm[s]].push_back(v);
	}
	vector<int>vec;
	int mx = 0;
	int ans = 0;
	int rq = 0;
	for(int i = 1; i<=cur; i++){
		if(vals[i].size()==0)continue;
		sort(vals[i].begin(),vals[i].end());
		rq+=max(0LL,vals[i].back()-arr[i]);
		mx = max(mx,(int)vals[i].size());
		if(vals[i].back()<arr[i]){
			ans+=vals[i].size()*arr[i];
			continue;
		}
		int cnt = 0;
		for(int nxt: vals[i]){
			if(nxt!=vals[i].back()){
				ans+=vals[i].back();
			}
			else{
				cnt++;
			}
		}
		vec.push_back(cnt*vals[i].back()+vals[i].size());
		
	}
	//cout << rq << '\n';
	if(rq > k){
		cout << "0\n";
		return 0;
	}
	//cout << rq << '\n';
	k-=rq;
	sort(vec.begin(),vec.end());
	while(vec.size() && k && vec.back() > mx){
		k--;
		ans+=vec.back();
		vec.pop_back();
	}
	ans+=k*mx;
	cout << ans << '\n';
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 3ms
memory: 9580kb

input:

3 14
THISISTHEONE 8
B 0
C 0
8
THISISTHEONE 10
C 0
B 1
B 0
THISISTHEONE 0
C 1
THISISTHEONE 0
THISISTHEONE 0

output:

82

result:

ok single line: '82'

Test #2:

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

input:

3 99
THEFIRSTINCREASE 6
SECONDINCREASE 4
ZZZ 1
9
THEFIRSTINCREASE 4
ZZZ 0
THEFIRSTINCREASE 6
SECONDINCREASE 8
THEFIRSTINCREASE 2
SECONDINCREASE 1
ZZZ 0
SECONDINCREASE 8
THEFIRSTINCREASE 3

output:

429

result:

ok single line: '429'

Test #3:

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

input:

5 20
A 100
B 200
C 300
D 400
E 500
949
A 39
A 23
C 163
A 98
B 36
A 3
A 52
B 152
B 167
B 65
C 142
B 66
B 117
C 288
C 155
E 341
A 97
D 173
E 31
A 62
D 90
E 361
A 42
D 85
E 1
C 141
B 77
B 194
D 221
E 203
D 345
E 48
B 26
D 46
B 74
E 380
B 181
C 243
B 112
A 99
E 403
C 20
E 453
C 149
B 26
E 245
A 74
D 304...

output:

285180

result:

ok single line: '285180'

Test #4:

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

input:

2 1
A 10
B 12
3
A 10
B 10
B 10

output:

35

result:

ok single line: '35'

Test #5:

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

input:

1 1
OVERENTHUSIASTICNESS 41
1
OVERENTHUSIASTICNESS 0

output:

42

result:

ok single line: '42'

Test #6:

score: 0
Accepted
time: 127ms
memory: 20136kb

input:

100000 1000000000
A 1000000000
B 1000000000
C 1000000000
D 1000000000
E 1000000000
F 1000000000
G 1000000000
H 1000000000
I 1000000000
J 1000000000
K 1000000000
L 1000000000
M 1000000000
N 1000000000
O 1000000000
P 1000000000
Q 1000000000
R 1000000000
S 1000000000
T 1000000000
U 1000000000
V 1000000...

output:

100007999593560

result:

ok single line: '100007999593560'

Test #7:

score: 0
Accepted
time: 122ms
memory: 19720kb

input:

100000 1000000000
A 1000000000
B 1000000000
C 1000000000
D 1000000000
E 1000000000
F 1000000000
G 1000000000
H 1000000000
I 1000000000
J 1000000000
K 1000000000
L 1000000000
M 1000000000
N 1000000000
O 1000000000
P 1000000000
Q 1000000000
R 1000000000
S 1000000000
T 1000000000
U 1000000000
V 1000000...

output:

100006999854911

result:

ok single line: '100006999854911'

Test #8:

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

input:

1 1000000000
A 1000000000
100000
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0
A 0...

output:

200000000000000

result:

ok single line: '200000000000000'

Test #9:

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

input:

1 1
A 0
1
A 0

output:

1

result:

ok single line: '1'

Test #10:

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

input:

1 800000
A 0
1000
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
A 10
A 11
A 12
A 13
A 14
A 15
A 16
A 17
A 18
A 19
A 20
A 21
A 22
A 23
A 24
A 25
A 26
A 27
A 28
A 29
A 30
A 31
A 32
A 33
A 34
A 35
A 36
A 37
A 38
A 39
A 40
A 41
A 42
A 43
A 44
A 45
A 46
A 47
A 48
A 49
A 50
A 51
A 52
A 53
A 54
A 55
A 56
A 57
A ...

output:

800000000

result:

ok single line: '800000000'

Test #11:

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

input:

2 1000000000
B 235
A 1000000000
100000
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A 1
A...

output:

200000000000000

result:

ok single line: '200000000000000'

Test #12:

score: 0
Accepted
time: 56ms
memory: 15032kb

input:

50457 435832308
A 192207613
B 218291430
C 72712030
D 8339557
E 233611631
F 924985735
G 707429015
H 495523396
I 1524253
J 940348426
K 191972642
L 421286578
M 162847048
N 280111507
O 601044189
P 929639718
Q 893573186
R 920586936
S 56283573
T 46461264
U 4612777
V 221232991
W 968811350
X 783669701
Y 667...

output:

0

result:

ok single line: '0'

Test #13:

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

input:

2836 44662413
A 269836858
B 972857889
C 51515364
D 328683395
E 526234284
F 689725572
G 769138643
H 790617490
I 48093964
J 243168110
K 180077017
L 623293643
M 981360167
N 645396090
O 412624316
P 709387419
Q 322883776
R 553162583
S 216235922
T 209753908
U 528154246
V 451750020
W 300516519
X 572996665
...

output:

0

result:

ok single line: '0'

Test #14:

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

input:

465 720708570
A 964489218
B 152054233
C 552095349
D 209903032
E 926041026
F 973820240
G 417242347
H 652805464
I 774473005
J 868230713
K 721131727
L 627241636
M 623019960
N 809095709
O 928690803
P 229390175
Q 595062361
R 273163306
S 798525471
T 972932324
U 333873971
V 927559188
W 926041190
X 64539094...

output:

0

result:

ok single line: '0'

Test #15:

score: 0
Accepted
time: 19ms
memory: 10544kb

input:

2658 922279939
A 179440353
B 624882483
C 104338141
D 130390676
E 328696385
F 669528812
G 938956597
H 134386530
I 854249965
J 282808688
K 695715582
L 326559726
M 707578888
N 290880040
O 20090871
P 896530690
Q 236292479
R 782324722
S 233253660
T 916440565
U 285886536
V 430491333
W 48525799
X 868428462...

output:

0

result:

ok single line: '0'

Test #16:

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

input:

8 274740128
A 787142485
B 216348350
C 116587980
D 963101420
E 296609285
F 76881088
G 324055267
H 97255786
4
D 278467507
G 929361476
A 103818943
D 335313499

output:

0

result:

ok single line: '0'

Test #17:

score: 0
Accepted
time: 16ms
memory: 10368kb

input:

355 325155415
A 44833348
B 871233156
C 31992384
D 149027764
E 941973900
F 913862251
G 836954440
H 165707546
I 703453203
J 238029892
K 936849814
L 951092717
M 621542577
N 135251097
O 526232560
P 154173639
Q 812248178
R 360837673
S 29361628
T 912681470
U 848101041
V 790156523
W 543481112
X 227403881
Y...

output:

0

result:

ok single line: '0'

Test #18:

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

input:

516 876102983
A 68079588
B 607865472
C 586115560
D 834251151
E 87957637
F 962496410
G 836754794
H 830728526
I 643131807
J 75363697
K 110415934
L 606888382
M 513209012
N 872632048
O 782613088
P 285301268
Q 376901180
R 675751665
S 216874851
T 517125466
U 301946024
V 435754958
W 466322875
X 633407709
Y...

output:

0

result:

ok single line: '0'

Test #19:

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

input:

6 690409537
A 548663356
B 706017338
C 306741866
D 951661376
E 383836924
F 709600248
1702
C 324469538
C 991088537
B 779024449
D 550683338
A 817153008
E 504793649
E 595511588
F 776506465
B 221367140
D 922156232
A 22456728
B 729727714
A 501225234
F 315280769
D 76402244
A 774494518
E 33765301
C 26334577...

output:

0

result:

ok single line: '0'

Test #20:

score: 0
Accepted
time: 33ms
memory: 13564kb

input:

54589 934238577
A 426157661
B 731298047
C 238356016
D 327872720
E 883602635
F 118182006
G 958721654
H 486056423
I 568843934
J 711551424
K 453315009
L 350421124
M 668088075
N 105446842
O 831801452
P 79487681
Q 103675132
R 576395265
S 971309192
T 78045673
U 674894656
V 179462575
W 557585061
X 38900798...

output:

4072850284

result:

ok single line: '4072850284'

Test #21:

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

input:

7 879093735
A 850928522
B 350468065
C 748796252
D 837694952
E 348921976
F 756802752
G 534822329
2052
B 967262777
B 393967428
E 502284363
A 940905594
E 810277410
A 568791040
D 511480180
G 65731261
E 671267678
F 595597916
F 240588953
B 180979922
C 671054842
B 914129862
D 260422699
F 669613469
E 197144...

output:

0

result:

ok single line: '0'

Test #22:

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

input:

6 842299994
A 379167737
B 115169471
C 119285747
D 943499403
E 177449883
F 10220555
1569
B 697422586
C 400884912
C 269415831
E 828123297
B 849064734
E 704245857
E 610386292
B 877095846
D 518961752
C 523904020
C 495900322
C 933105747
C 450242097
A 769402759
E 287913977
C 404068305
E 781388043
D 472512...

output:

0

result:

ok single line: '0'

Test #23:

score: 0
Accepted
time: 65ms
memory: 15936kb

input:

64738 943472339
A 979065476
B 832949548
C 152126332
D 575907209
E 811321449
F 712120870
G 723326799
H 889941752
I 467316971
J 595719757
K 927907719
L 53991523
M 673203943
N 126964655
O 824177390
P 4268947
Q 290023999
R 461758370
S 323213342
T 311180813
U 865360504
V 661904574
W 181180161
X 721973291...

output:

0

result:

ok single line: '0'

Test #24:

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

input:

8 53861228
A 891720756
B 341615418
C 247127721
D 114705614
E 794800619
F 535476057
G 472546264
H 17162179
2164
D 59853020
B 972442325
F 406778948
G 583852826
E 818558037
H 237153728
F 791306889
D 938863078
A 481681370
C 501216450
H 276218794
C 564718804
F 61396156
B 32108808
E 268680596
D 740046589
...

output:

0

result:

ok single line: '0'

Test #25:

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

input:

7 412675199
A 917821399
B 836089065
C 131844033
D 670963745
E 429723800
F 400355535
G 977010106
1727
F 308538376
B 935247759
D 491075499
C 374071258
A 224676327
E 676481834
G 423340823
D 641914255
B 704683198
A 377398567
G 272649163
C 304228705
G 376493987
G 606275219
F 830823140
B 812720422
F 17191...

output:

0

result:

ok single line: '0'

Test #26:

score: 0
Accepted
time: 22ms
memory: 14136kb

input:

57374 711276406
A 613156442
B 82011174
C 10463444
D 12802565
E 437036386
F 95927948
G 350288062
H 151941178
I 646283948
J 677004796
K 990479171
L 789096157
M 564621747
N 355408210
O 507084367
P 12697544
Q 211495000
R 602910948
S 76342025
T 199206245
U 80989675
V 490978999
W 438227462
X 501156116
Y 7...

output:

0

result:

ok single line: '0'

Test #27:

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

input:

6 332497508
A 711034572
B 407702010
C 568304901
D 659423025
E 316462184
F 367066900
5
A 595718092
E 48734900
D 343645794
D 451342914
A 630129036

output:

3722372394

result:

ok single line: '3722372394'

Test #28:

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

input:

1666 451934537
A 342650525
B 91252632
C 298571149
D 817065369
E 853857673
F 81868669
G 422520903
H 322430130
I 196304023
J 456374454
K 927449288
L 497007895
M 929749589
N 545239160
O 535738197
P 64154330
Q 557982713
R 89376619
S 485410593
T 580548727
U 157583689
V 976335802
W 986118132
X 849368305
Y...

output:

0

result:

ok single line: '0'

Test #29:

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

input:

1651 407668104
A 458317692
B 909435400
C 741022991
D 233178625
E 313863379
F 7949477
G 141369403
H 630890074
I 66872471
J 279856115
K 923864992
L 151312340
M 417007154
N 399894770
O 69017739
P 548150733
Q 437095676
R 220116084
S 253200337
T 301479723
U 156710761
V 626785328
W 1882138
X 755509454
Y 2...

output:

0

result:

ok single line: '0'

Test #30:

score: 0
Accepted
time: 64ms
memory: 15196kb

input:

55686 808700322
A 34664429
B 917493539
C 860519058
D 806167135
E 196866799
F 857809984
G 933756527
H 978074492
I 86246168
J 205452256
K 615177430
L 631659858
M 472137097
N 109420732
O 265983334
P 563177753
Q 79568891
R 625998292
S 798618556
T 499423935
U 866419872
V 812223015
W 749984116
X 593584291...

output:

0

result:

ok single line: '0'

Test #31:

score: 0
Accepted
time: 32ms
memory: 14052kb

input:

55068 670749199
A 354429008
B 534732910
C 476171149
D 39980987
E 7922157
F 785200131
G 72923364
H 128554320
I 703066856
J 491260143
K 389319695
L 910861355
M 620520758
N 232407731
O 482501720
P 285917225
Q 871459300
R 897151314
S 856870482
T 581791393
U 255026002
V 257072875
W 527993351
X 5605973
Y ...

output:

0

result:

ok single line: '0'

Test #32:

score: 0
Accepted
time: 12ms
memory: 9916kb

input:

8 1302605
A 134287489
B 573282005
C 300684184
D 837596997
E 827512071
F 582064343
G 494505886
H 541393637
54301
C 585334477
B 41308975
B 937525630
F 904321787
G 784948851
F 249994222
G 282089489
B 555497919
E 118133744
C 19250881
E 996634220
D 807449144
H 366721213
C 803919575
D 77742245
A 939221251...

output:

0

result:

ok single line: '0'

Test #33:

score: 0
Accepted
time: 37ms
memory: 14440kb

input:

65692 141672743
A 879111798
B 208999764
C 219696947
D 335711396
E 994357505
F 841578478
G 650693339
H 131587825
I 800838292
J 50756269
K 226369807
L 250533548
M 700677866
N 979860504
O 20239766
P 652697062
Q 541122563
R 680348402
S 687780120
T 228125455
U 681569920
V 608655539
W 45180496
X 377028083...

output:

0

result:

ok single line: '0'

Test #34:

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

input:

8 937449651
A 132265030
B 466908475
C 536633364
D 333405397
E 446012016
F 189415547
G 97170372
H 511334059
2302
H 274089471
H 720270279
C 320288129
B 54458530
C 556081819
D 138819439
B 703339773
C 88307151
C 497799547
G 503433922
H 734206266
B 87503806
D 823570154
H 149232652
B 206861255
E 878946850...

output:

0

result:

ok single line: '0'

Test #35:

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

input:

1449 10923999
A 663761329
B 98982403
C 98188974
D 801248187
E 815496608
F 469049136
G 431475286
H 664339712
I 216554048
J 406215776
K 244437043
L 241651531
M 632573840
N 274839844
O 581816514
P 957938624
Q 178553700
R 572318284
S 110717151
T 418572568
U 106199122
V 418140358
W 438960064
X 558540062
...

output:

0

result:

ok single line: '0'

Test #36:

score: 0
Accepted
time: 12ms
memory: 9884kb

input:

7 823300961
A 721849235
B 700707242
C 643102502
D 81447467
E 486710849
F 835244553
G 906828063
56493
E 842344104
G 98591759
A 931741972
A 892916194
G 176433338
B 588709412
A 650523027
D 999189608
A 947818425
B 695834149
A 13889810
D 746695432
F 535129636
D 75253858
C 100428190
B 429077751
B 55665355...

output:

0

result:

ok single line: '0'

Test #37:

score: 0
Accepted
time: 15ms
memory: 10152kb

input:

57 868750896
A 404861638
B 45332195
C 636257002
D 442790255
E 764452001
F 496390941
G 100558829
H 109071496
I 825410260
J 454859111
K 507977989
L 58855441
M 660079869
N 236590656
O 558128363
P 669440808
Q 24054160
R 631971551
S 658443629
T 231980163
U 165402378
V 509899789
W 368656077
X 812803319
Y ...

output:

45058035839168

result:

ok single line: '45058035839168'

Test #38:

score: 0
Accepted
time: 52ms
memory: 16008kb

input:

85565 707071591
A 887733008
B 867938476
C 806988939
D 550192346
E 760098436
F 352438566
G 965215269
H 935667009
I 391055044
J 756582017
K 973262091
L 919574183
M 584331081
N 775915386
O 175156350
P 45635734
Q 928578594
R 496640571
S 678764224
T 268507085
U 110048928
V 167477822
W 909636174
X 8379317...

output:

346372293431

result:

ok single line: '346372293431'

Test #39:

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

input:

14 716061531
A 498316749
B 373305418
C 455531456
D 765787205
E 593658461
F 63911294
G 983798535
H 348572033
I 606225225
J 729414669
K 799648912
L 230507042
M 226990172
N 621879747
339
N 464456354
N 601653126
G 983806768
K 799666165
B 373316428
J 126108232
H 348581656
H 317960564
N 446278844
F 575408...

output:

206967461904

result:

ok single line: '206967461904'

Test #40:

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

input:

18 512022636
A 270775411
B 369733299
C 49626174
D 819800834
E 495563531
F 601796770
G 41428420
H 556211927
I 313414220
J 44461966
K 613262402
L 546577861
M 322057063
N 347541241
O 295279751
P 545302975
Q 241307800
R 502384107
929
A 270780511
H 556228614
M 99126278
G 41435429
J 14075616
N 347547952
N...

output:

393771446000

result:

ok single line: '393771446000'

Test #41:

score: 0
Accepted
time: 56ms
memory: 17048kb

input:

98706 868485793
A 255549860
B 723992922
C 348458122
D 987124485
E 747413436
F 486119762
G 190998737
H 527113823
I 40878035
J 83860806
K 425164312
L 937370582
M 33562252
N 563809
O 575488324
P 17029507
Q 560570217
R 730720818
S 909862584
T 924344187
U 477812426
V 188807262
W 295224870
X 861093251
Y 8...

output:

69188101589

result:

ok single line: '69188101589'

Test #42:

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

input:

19 837409111
A 960332080
B 35838479
C 909407355
D 945376388
E 564946990
F 126137903
G 511850489
H 877228125
I 259743508
J 294381172
K 102476865
L 686897775
M 183973949
N 295012092
O 118606363
P 433336465
Q 600689087
R 852587282
S 360369284
13
N 92679049
I 255896871
K 17737057
J 84203075
A 960350028
...

output:

5852559653

result:

ok single line: '5852559653'

Test #43:

score: 0
Accepted
time: 35ms
memory: 15156kb

input:

71969 202752801
A 382951691
B 739041175
C 863497953
D 387446399
E 88824447
F 886573339
G 390101783
H 197276337
I 415045353
J 793102088
K 875088205
L 532879073
M 788426677
N 701301976
O 117842785
P 406122078
Q 61077364
R 193621992
S 186548478
T 975995066
U 519624586
V 687450586
W 576861203
X 50885601...

output:

6347188034

result:

ok single line: '6347188034'

Test #44:

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

input:

11 90128559
A 96073708
B 557367810
C 510535449
D 236188234
E 119565591
F 116812097
G 872188870
H 132097649
I 62534865
J 41202308
K 1261729
13
J 41212383
J 41228436
C 56737050
A 96082026
J 15998546
B 725862
C 510544327
E 16105215
H 47230290
G 872189538
D 236205531
F 996250
E 119580602

output:

3664846586

result:

ok single line: '3664846586'

Test #45:

score: 0
Accepted
time: 53ms
memory: 16780kb

input:

93897 663245808
A 546092314
B 97330706
C 133202163
D 977594261
E 867787194
F 569284262
G 601336862
H 310557327
I 673481238
J 167644682
K 758020743
L 589353890
M 262672375
N 479559508
O 53442482
P 258656394
Q 383953020
R 388234323
S 980984148
T 799351085
U 509036146
V 493367099
W 331558521
X 92836485...

output:

6108436785

result:

ok single line: '6108436785'

Test #46:

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

input:

72 54024919
A 22122104
B 54174308
C 641782797
D 341762140
E 180445632
F 75024829
G 916081797
H 138581810
I 418239325
J 735301871
K 758942193
L 982849863
M 991565997
N 480219693
O 560369126
P 689184540
Q 459159302
R 704265287
S 216981120
T 110674537
U 550244814
V 954635178
W 376110966
X 338088732
Y 4...

output:

8625484793

result:

ok single line: '8625484793'

Test #47:

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

input:

15 506733605
A 200132320
B 408054064
C 61840160
D 714427361
E 3036590
F 844256496
G 678668519
H 822086182
I 182860444
J 439974783
K 635189027
L 794249900
M 711476908
N 435739232
O 864660044
734
L 794252133
E 568381
A 75601178
G 587438320
J 439978109
A 74799
O 77600849
G 394110242
N 78346413
J 729252...

output:

418403225876

result:

ok single line: '418403225876'

Test #48:

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

input:

41 990886280
A 776057746
B 975263771
C 813174358
D 286868823
E 736266493
F 695653047
G 12298113
H 464897987
I 737595479
J 656690974
K 296907680
L 92435290
M 456032516
N 217461560
O 91774943
P 745681162
Q 318794159
R 780778145
S 148797109
T 807671052
U 755668529
V 453779878
W 928702889
X 780254498
Y ...

output:

561541694442

result:

ok single line: '561541694442'

Test #49:

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

input:

15 240697118
A 714886699
B 512719457
C 241048697
D 185865711
E 701230404
F 960266273
G 651575062
H 403470323
I 103230797
J 434353788
K 227499384
L 511136710
M 232192079
N 173766750
O 163905081
789
F 733392245
E 485916080
E 99048765
K 197355487
K 216137879
K 227502259
O 163916330
H 297630306
K 410002...

output:

332484400880

result:

ok single line: '332484400880'

Test #50:

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

input:

18 254338443
A 530679548
B 420530397
C 811698741
D 878206449
E 413180068
F 25439685
G 946459980
H 146358489
I 886971594
J 472616835
K 225405948
L 3337465
M 61470744
N 534742415
O 89050167
P 245384457
Q 701145799
R 49302929
9
Q 536335535
B 264172247
K 7308732
K 207936690
M 61475717
G 58169854
I 88698...

output:

5342760600

result:

ok single line: '5342760600'

Test #51:

score: 0
Accepted
time: 54ms
memory: 15696kb

input:

82166 500456870
A 308146266
B 530990125
C 451821441
D 32158706
E 923913242
F 209435781
G 930853683
H 34645925
I 603963955
J 201618549
K 927823906
L 75585559
M 210188749
N 70880579
O 240894725
P 572698047
Q 762557427
R 494807376
S 772814971
T 14346808
U 449735419
V 939023825
W 341191794
X 704508588
Y...

output:

5563279362

result:

ok single line: '5563279362'

Test #52:

score: 0
Accepted
time: 101ms
memory: 17088kb

input:

70244 5797535
A 589397504
B 747542209
C 900871279
D 347743398
E 475680917
F 161497885
G 146523991
H 67933403
I 2456767
J 684854825
K 638215676
L 329608111
M 108644383
N 591790673
O 922462724
P 698200074
Q 832711885
R 593128538
S 884462408
T 817690549
U 575413680
V 573791044
W 64730011
X 651771125
Y ...

output:

33639632879972

result:

ok single line: '33639632879972'

Test #53:

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

input:

17 531657079
A 241405427
B 141642887
C 255884915
D 571314679
E 444159979
F 909632234
G 648731945
H 584357532
I 558575126
J 853681856
K 664841417
L 780619241
M 567952502
N 350997691
O 790887040
P 450589258
Q 915884111
689
L 323158641
L 780627283
H 584361008
E 163509717
H 584373909
A 126387626
M 40567...

output:

428565523190

result:

ok single line: '428565523190'

Test #54:

score: 0
Accepted
time: 109ms
memory: 18824kb

input:

93662 21169636
A 613616025
B 328112946
C 322755766
D 368968502
E 300793643
F 714551155
G 645401379
H 968030378
I 608908081
J 897911442
K 208646260
L 769875970
M 203161203
N 51613968
O 893214079
P 631746860
Q 4470913
R 847389856
S 261556626
T 706000714
U 892114119
V 690349957
W 717659823
X 219321223
...

output:

26467245225583

result:

ok single line: '26467245225583'

Test #55:

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

input:

64 330347693
A 99506765
B 930802721
C 997488639
D 646796031
E 833330809
F 355178693
G 472518742
H 389290912
I 743061272
J 165716829
K 758723497
L 246776595
M 302822602
N 79979604
O 655572302
P 877343244
Q 929909919
R 787016128
S 81808092
T 804820238
U 786875850
V 808618663
W 593219253
X 722996864
Y ...

output:

179289556556

result:

ok single line: '179289556556'

Test #56:

score: 0
Accepted
time: 36ms
memory: 14900kb

input:

72775 910476363
A 934322222
B 646342711
C 557807731
D 293602382
E 694784322
F 204251412
G 378900344
H 204653704
I 661522109
J 408714302
K 627509423
L 251972310
M 219919290
N 174605368
O 697312402
P 105904398
Q 481471567
R 548215023
S 918685577
T 400175867
U 404234707
V 70196404
W 497897768
X 7232632...

output:

9246358469

result:

ok single line: '9246358469'

Test #57:

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

input:

17 70931848
A 339230705
B 960478875
C 367207415
D 958279754
E 929570374
F 48449750
G 583927975
H 280748344
I 339723819
J 288840190
K 377700002
L 763521839
M 374493615
N 191251143
O 208889485
P 407417921
Q 941767705
14
K 104794040
A 155769696
Q 941786710
B 769440603
D 918818170
P 45554723
L 763525861...

output:

7711701520

result:

ok single line: '7711701520'

Test #58:

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

input:

94 525256035
A 636977050
B 58873802
C 982522398
D 8480124
E 470732240
F 164340944
G 972269369
H 57851538
I 369396205
J 278551519
K 581396254
L 18399703
M 322081765
N 631989112
O 208797107
P 727207054
Q 485028905
R 47273604
S 551381328
T 91273950
U 694050610
V 14018667
W 454656733
X 44574144
Y 292290...

output:

89182560035

result:

ok single line: '89182560035'

Test #59:

score: 0
Accepted
time: 44ms
memory: 16004kb

input:

86387 598530223
A 476058018
B 215112957
C 32113129
D 693216005
E 448796014
F 676483923
G 733222421
H 487030088
I 592541540
J 133550655
K 485241292
L 717522583
M 50668860
N 39229121
O 70925495
P 112561512
Q 223252910
R 802559695
S 973655508
T 340839970
U 643421939
V 871361116
W 211262727
X 924193374
...

output:

4287983436

result:

ok single line: '4287983436'

Test #60:

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

input:

15 674149369
A 505484407
B 10166371
C 996387219
D 104785684
E 791553465
F 970219962
G 951489364
H 223704873
I 493773341
J 344367509
K 376015206
L 27263765
M 663343200
N 529376034
O 28873330
474
C 996406604
I 108331806
N 529381729
B 6100411
J 344379696
H 138061615
H 223724776
M 248659543
F 970235806
...

output:

257523207042

result:

ok single line: '257523207042'

Test #61:

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

input:

20 218637750
A 935513990
B 338647598
C 461119715
D 454429519
E 610930740
F 573014609
G 307325199
H 500893846
I 76716433
J 550260020
K 289182182
L 395383719
M 304176
N 370277435
O 397799053
P 105233924
Q 699528868
R 722927212
S 792564677
T 589936554
93731
G 105606220
S 792568416
C 461128975
T 5899498...

output:

44082526613870

result:

ok single line: '44082526613870'

Test #62:

score: 0
Accepted
time: 41ms
memory: 15376kb

input:

73379 920449677
A 352490438
B 775048269
C 424201548
D 71888636
E 861893905
F 87287802
G 522887143
H 332325797
I 506603948
J 632872136
K 610438231
L 601303661
M 201044619
N 420413151
O 290132807
P 537551271
Q 813201809
R 567562765
S 77035717
T 20509708
U 136457994
V 55904818
W 521530819
X 257798275
Y...

output:

234022821337

result:

ok single line: '234022821337'

Test #63:

score: 0
Accepted
time: 22ms
memory: 10708kb

input:

44 317346656
A 954282530
B 630735704
C 266797897
D 443579264
E 321099193
F 616515963
G 942424259
H 671963840
I 699240116
J 877097133
K 770632055
L 95556468
M 330723070
N 861973004
O 220864480
P 385752983
Q 482653311
R 443470800
S 969293987
T 410511348
U 944426669
V 661238020
W 748335537
X 420090161
...

output:

49869926790708

result:

ok single line: '49869926790708'

Test #64:

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

input:

16 700377042
A 758801147
B 751333440
C 170344791
D 312195975
E 887536202
F 717518195
G 191062870
H 176428786
I 180348133
J 677458160
K 676531646
L 11730338
M 759204803
N 781775552
O 302234237
P 338015907
599
M 657202562
C 41911766
D 107429779
K 73808935
N 613639099
P 338017868
A 758807696
E 38750150...

output:

331497117205

result:

ok single line: '331497117205'

Test #65:

score: 0
Accepted
time: 100ms
memory: 18856kb

input:

91147 872862989
A 431277758
B 997811041
C 586305917
D 665582909
E 840448491
F 73970527
G 659944341
H 260554706
I 213526404
J 577241766
K 362617540
L 906595195
M 808995443
N 300580991
O 613120592
P 596929660
Q 201937039
R 190298661
S 361689600
T 619326684
U 741394040
V 853383846
W 185590487
X 6508524...

output:

38071085157859

result:

ok single line: '38071085157859'

Test #66:

score: 0
Accepted
time: 39ms
memory: 14968kb

input:

72839 578432272
A 54612718
B 139078614
C 728238663
D 453773028
E 858233064
F 441344673
G 632268578
H 632261275
I 250966601
J 639752944
K 335697390
L 47023798
M 646496146
N 513077281
O 300814323
P 517734212
Q 201896035
R 963887295
S 640666177
T 58366136
U 125901123
V 518575348
W 891290151
X 717381560...

output:

8449413811

result:

ok single line: '8449413811'

Test #67:

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

input:

12 915919717
A 852478788
B 252847274
C 567342943
D 766001724
E 398979290
F 569797519
G 899223392
H 931231885
I 161049654
J 359456730
K 929425883
L 684205832
10
C 567355210
K 747758074
D 766014277
I 161061647
A 852496755
B 220761181
K 929429816
A 852508776
J 359472384
C 122307379

output:

8069649841

result:

ok single line: '8069649841'

Test #68:

score: 0
Accepted
time: 20ms
memory: 10484kb

input:

54 518163297
A 230679647
B 966663471
C 157281530
D 605099526
E 180658551
F 842650769
G 144232633
H 50030931
I 917869410
J 380327600
K 922026995
L 400396286
M 536300237
N 218856232
O 333824717
P 750121922
Q 456349657
R 208836266
S 541328614
T 862603268
U 956652818
V 251299235
W 109063138
X 651988930
...

output:

47953801111545

result:

ok single line: '47953801111545'

Test #69:

score: 0
Accepted
time: 17ms
memory: 10568kb

input:

16 325432140
A 387498275
B 384885025
C 839412224
D 607405346
E 428769983
F 308477456
G 863369874
H 372806756
I 291492036
J 704809557
K 906138497
L 167025882
M 145236824
N 446045181
O 74716052
P 371073536
99880
B 313197598
M 93370680
L 167045401
C 839420316
G 85633421
F 308497189
D 388947074
B 283650...

output:

47553755180575

result:

ok single line: '47553755180575'

Test #70:

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

input:

11 743242237
A 814689996
B 665442655
C 528164074
D 520065903
E 520637396
F 765441199
G 420417913
H 302564051
I 570154576
J 549897162
K 409354544
781
D 247323879
E 280527210
G 107813401
A 814703078
K 409354670
K 409361824
J 549916189
D 205669921
H 302576096
A 485469930
C 398976586
E 520641439
A 81472...

output:

496835155531

result:

ok single line: '496835155531'

Test #71:

score: 0
Accepted
time: 41ms
memory: 16512kb

input:

90785 240253897
A 954747795
B 156721391
C 270618334
D 342381821
E 921019496
F 847608995
G 896144905
H 735687954
I 85141609
J 129746355
K 284011555
L 366344600
M 769507645
N 978300664
O 844368164
P 191671574
Q 94253123
R 952304471
S 804489599
T 830253430
U 185062430
V 638176342
W 334861847
X 48439181...

output:

387714276929

result:

ok single line: '387714276929'

Test #72:

score: 0
Accepted
time: 53ms
memory: 17084kb

input:

99170 429241648
A 245671951
B 923558193
C 79400519
D 626836004
E 592713619
F 719625282
G 932027953
H 835364755
I 151164328
J 139168420
K 432029115
L 808892980
M 775932010
N 373296265
O 781173635
P 985879857
Q 382880456
R 738626583
S 345064591
T 558854299
U 199208657
V 408203236
W 733665148
X 2228815...

output:

36573369357

result:

ok single line: '36573369357'

Test #73:

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

input:

69 666748677
A 541137912
B 207082960
C 155477879
D 193957015
E 610794364
F 317271664
G 311836470
H 467232533
I 345149798
J 210207140
K 740696862
L 640837772
M 200257364
N 2450162
O 559886191
P 984024188
Q 599770723
R 479911545
S 922600593
T 107692926
U 51631968
V 471536564
W 41749953
X 935862831
Y 1...

output:

5971732872

result:

ok single line: '5971732872'

Test #74:

score: 0
Accepted
time: 12ms
memory: 10480kb

input:

17 940033834
A 708368529
B 746326919
C 413720946
D 641592580
E 814951750
F 451622379
G 434717498
H 676833372
I 502186355
J 683186685
K 226719429
L 574666063
M 531334617
N 562375353
O 2305891
P 534316426
Q 571056725
72979
K 2955313
K 224128949
I 502194293
C 413738092
H 676846821
D 475135722
M 5313536...

output:

43151612001082

result:

ok single line: '43151612001082'

Test #75:

score: 0
Accepted
time: 18ms
memory: 10620kb

input:

18 638223428
A 123544761
B 627263312
C 387957754
D 139414804
E 273700824
F 340024348
G 748343330
H 908205696
I 185983491
J 894565018
K 197430873
L 883059576
M 191038117
N 561049377
O 43741661
P 740400019
Q 791310888
R 854532097
86413
D 32653430
N 88787719
J 805116044
K 74426125
F 137740791
B 1057191...

output:

45794571342614

result:

ok single line: '45794571342614'

Test #76:

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

input:

17 315237750
A 781874999
B 760397147
C 32030860
D 263950630
E 693541732
F 119263423
G 645216796
H 130965452
I 814083571
J 635898768
K 335025206
L 984800832
M 24547488
N 146469707
O 293002131
P 867989112
Q 195685472
11
B 590636935
M 19844447
K 335030944
Q 195702371
H 92396000
E 277918770
M 19919343
L...

output:

5246926020

result:

ok single line: '5246926020'

Test #77:

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

input:

82 211358231
A 634958095
B 970825236
C 927020210
D 266827219
E 262734768
F 772689440
G 306535196
H 409322656
I 747019848
J 651329112
K 169354318
L 231000436
M 233133058
N 110546510
O 378928644
P 750237095
Q 988478953
R 294320715
S 312069556
T 937251338
U 686689540
V 317590566
W 489199220
X 818375300...

output:

2514977879

result:

ok single line: '2514977879'

Test #78:

score: 0
Accepted
time: 14ms
memory: 10628kb

input:

14 200053596
A 294913172
B 303362107
C 813640305
D 979263204
E 597382726
F 214156501
G 27171730
H 686585980
I 65108514
J 296321845
K 21052237
L 337857397
M 163547287
N 189443119
83824
J 296333585
K 4008178
J 243730912
G 15103478
D 605314782
C 740582877
L 247216402
A 75942665
J 296332270
M 163555175
...

output:

31178222281585

result:

ok single line: '31178222281585'

Test #79:

score: 0
Accepted
time: 97ms
memory: 18048kb

input:

84638 662622498
A 833656023
B 163626387
C 632742705
D 488598553
E 818000941
F 560102761
G 13179368
H 812962456
I 732500877
J 65601087
K 64210375
L 491730220
M 828014776
N 160552962
O 688267918
P 177407638
Q 434837779
R 456501211
S 298537532
T 128883566
U 311032870
V 243307883
W 937352225
X 532513148...

output:

36684811781041

result:

ok single line: '36684811781041'

Test #80:

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

input:

20 70769643
A 446037549
B 664887576
C 667061735
D 302310473
E 930746976
F 316630381
G 47077845
H 515941331
I 180235038
J 68546817
K 459871307
L 89423492
M 363736336
N 476131207
O 671099371
P 834658614
Q 550195165
R 389120597
S 774296998
T 722115707
10
F 175887001
T 722118842
I 180251221
H 515959529
...

output:

5296495124

result:

ok single line: '5296495124'

Test #81:

score: 0
Accepted
time: 14ms
memory: 10564kb

input:

20 432821405
A 494282097
B 928371988
C 943919932
D 477885985
E 801989240
F 601046478
G 197317398
H 635302404
I 93109294
J 108926365
K 508139535
L 138257769
M 420640808
N 972706100
O 990541832
P 740161765
Q 190564294
R 408990767
S 900730267
T 613246835
82814
F 303161721
L 57504230
H 222535397
G 19733...

output:

48016286339903

result:

ok single line: '48016286339903'

Test #82:

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

input:

62 400757756
A 605804899
B 241696589
C 483502541
D 333075812
E 841045593
F 401711091
G 826229641
H 753845067
I 214561992
J 263702385
K 550355814
L 661219161
M 638108652
N 178679335
O 701316665
P 306752088
Q 846844672
R 716119753
S 914916093
T 12248530
U 316690525
V 363739908
W 857626375
X 222793824
...

output:

50778880602

result:

ok single line: '50778880602'

Test #83:

score: 0
Accepted
time: 109ms
memory: 18296kb

input:

84220 608382162
A 650194995
B 669966832
C 248491211
D 367038354
E 207758132
F 45006885
G 576095870
H 790462165
I 550895229
J 960346509
K 966173152
L 81057673
M 200360495
N 39488088
O 397643662
P 559438706
Q 103547694
R 886078467
S 228103482
T 365037100
U 548438686
V 805920564
W 526190614
X 253603413...

output:

47153644739378

result:

ok single line: '47153644739378'

Test #84:

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

input:

85 808764533
A 104474456
B 252550403
C 50638658
D 295646013
E 486553353
F 307733696
G 603412903
H 92095826
I 286383948
J 954110564
K 144005938
L 673131370
M 432761429
N 977618364
O 497739612
P 753958729
Q 509518935
R 168418325
S 309672615
T 727727734
U 226742980
V 128580200
W 140527714
X 851004775
Y...

output:

5080185046

result:

ok single line: '5080185046'

Test #85:

score: 0
Accepted
time: 19ms
memory: 10428kb

input:

18 416689041
A 720887742
B 505750677
C 657711425
D 40914009
E 573579703
F 164450946
G 823585699
H 163045620
I 507777657
J 538518021
K 259090915
L 473266071
M 530910806
N 335775878
O 612547562
P 830262372
Q 925847917
R 184414157
88323
I 230483135
J 262141818
E 335924442
K 259096577
M 463271655
D 1661...

output:

45590388644888

result:

ok single line: '45590388644888'

Test #86:

score: 0
Accepted
time: 22ms
memory: 10560kb

input:

62 810992934
A 501387080
B 431358667
C 915346657
D 182033415
E 477288199
F 112248894
G 541907148
H 518899909
I 682579019
J 707810101
K 343525830
L 586899767
M 39351401
N 428315367
O 944979377
P 92349216
Q 167212870
R 688011887
S 205773793
T 493111797
U 671851220
V 581759317
W 457214237
X 675466120
Y...

output:

43709220752355

result:

ok single line: '43709220752355'

Test #87:

score: 0
Accepted
time: 88ms
memory: 16344kb

input:

62390 209304867
OKD 827070231
SWG 325654065
CBTL 655198642
ASFV 642641711
BQOD 714279368
KVT 546952355
CJVT 961105586
MLM 343454502
CHNS 619403697
BHBE 918327209
DCX 338383630
CCI 475310069
ZS 275407335
BZDU 564035892
AIMS 412529066
BSBT 184015031
ADWB 185377182
HUO 623661541
BRPT 219040141
BPDX 628...

output:

38322869283647

result:

ok single line: '38322869283647'

Test #88:

score: 0
Accepted
time: 116ms
memory: 17552kb

input:

73610 246081399
CBOF 908300329
CTAM 460195555
CSOA 798563973
BQQG 490585918
FLH 971681757
BDSO 799635471
AFIM 301080391
TYO 928487852
CYNE 357433276
ASQQ 247728119
WLD 379981338
BTBP 310703227
AUL 427761620
CWWE 525655169
CCQX 297207810
IMW 550803053
BWXA 888893521
BLQS 338035493
ACJD 714142643
BVOP...

output:

47285808388844

result:

ok single line: '47285808388844'

Test #89:

score: 0
Accepted
time: 142ms
memory: 19516kb

input:

94657 267984330
CWYW 293764820
EAEN 138407983
GSW 528784578
FQC 183720760
CLCT 952772070
ADGB 446379722
ONG 177219151
BDMW 333287035
DZNX 254308477
ANPX 991963655
KU 293971223
EADJ 540648443
DARS 125435057
QPZ 931712810
QMM 330823107
CJDT 391002074
BINB 346381946
BREU 681853749
CCOK 421089654
DDJF 3...

output:

30325626044366

result:

ok single line: '30325626044366'

Test #90:

score: 0
Accepted
time: 103ms
memory: 16164kb

input:

60972 204581187
YOP 186854318
TUI 695999736
AAG 142368424
APFG 733384166
YJT 632587390
JSK 302008391
BNJJ 563109520
BHEQ 992208598
CARY 815541610
ACFH 296159329
BVOZ 899785400
BJHI 663868692
AWZN 798176792
AWPN 732153276
ALOA 543288387
ARQQ 153524296
AJJX 879119117
BYQK 993272557
AVDT 699443098
CETS...

output:

31930791830553

result:

ok single line: '31930791830553'

Test #91:

score: 0
Accepted
time: 146ms
memory: 19180kb

input:

93258 266854709
BNNG 303011497
DCRZ 869801584
BHNN 404282678
CIA 235894339
BMHK 145017206
BMPV 620512895
BWJN 815573597
CDPD 336286859
CDPB 782317308
VHX 381540354
LQG 915360971
HSR 606630408
UYF 793052656
DEWH 821107344
BIMY 410993881
AEWM 969711715
CUTF 335420292
BNPT 827602667
DSHY 567758467
DKHZ...

output:

49458560281716

result:

ok single line: '49458560281716'

Test #92:

score: 0
Accepted
time: 132ms
memory: 18204kb

input:

79715 266786588
DHCJ 961932743
BCIF 476700920
CIG 609969599
CRVV 974964257
ABZX 504208874
BZAR 620512868
AGYM 792205659
DLXG 775903512
AGIP 849976483
DDOY 691173318
CRYH 729699055
BGCD 617719098
AOTA 344668380
BAWG 751301442
APNZ 932154180
QL 880528067
BAZP 726467474
CNUP 659205832
DEWV 864190108
BO...

output:

52769094144291

result:

ok single line: '52769094144291'

Test #93:

score: 0
Accepted
time: 77ms
memory: 15816kb

input:

56977 190664145
KHS 360219077
AKYA 344243491
BUUZ 347464827
ACVX 239391174
AEEB 780097021
BFUA 875477548
BYBH 139992008
ARWW 499216164
AANF 341910180
AGI 724098813
VTU 839543031
CBKL 854929496
BXOQ 905496329
BQGA 278427819
AEFS 753948811
ANTJ 148776428
BWXV 328221366
AMVG 366393931
BMNB 989106359
DW...

output:

15971086024120

result:

ok single line: '15971086024120'

Test #94:

score: 0
Accepted
time: 141ms
memory: 19028kb

input:

90408 269269457
BJEH 625619032
AVI 726640657
AVWZ 252043184
BDFJ 606171267
BEAQ 201042296
NQS 909128125
BKJH 647604167
BRVB 293098152
AXJK 536555338
LWJ 833861707
DPOU 807025062
DEOD 731306207
DHHO 348522600
LZQ 133205320
BAOD 850371625
DGZK 696804232
BMCQ 300810852
DDMA 485613582
CNOC 266530260
BPP...

output:

54014039620662

result:

ok single line: '54014039620662'

Test #95:

score: 0
Accepted
time: 145ms
memory: 18876kb

input:

86527 269663888
CGOE 582561891
ACZX 412014211
AKBD 918994904
BLLD 126566844
DROD 120370669
PQI 358382594
BACA 663743776
CQCP 287266620
BBZ 903376780
CBGN 790257398
ADOY 900434643
ACM 638818373
AESM 438761024
DQZB 503621349
DKBX 536955369
CBCP 537402612
CPZ 672083685
DNZN 566539428
DLLG 836692804
JIP...

output:

51520961920615

result:

ok single line: '51520961920615'

Test #96:

score: 0
Accepted
time: 88ms
memory: 16060kb

input:

57981 194863044
BJHU 818926067
ALJ 340372535
SOH 784532259
AQLW 276751492
JK 269201493
ACL 167415599
AOHZ 541029797
YEW 620649123
BFDZ 953087735
LLB 452679807
CCYH 960983055
DSS 651846818
AVMG 734444602
CALW 399161734
KOB 565554545
FEE 986378419
BDRJ 826916902
ZAI 729055467
RWA 254847042
AQAI 529424...

output:

29774835112607

result:

ok single line: '29774835112607'

Test #97:

score: 0
Accepted
time: 148ms
memory: 19200kb

input:

90543 268552850
CUTH 236297358
CPXT 218715461
DVVJ 464662705
DYA 751431793
AKOP 286961424
NNA 219193357
CEP 486596509
AFJY 343575575
TAG 414434502
BHKQ 246737811
BVVZ 614329405
BCOO 928663287
CLKH 551649395
DBLM 352639532
BMAO 661085615
DLTL 532167779
BPRK 976636086
BXHJ 844794368
DVUX 167573723
UEY...

output:

17304301440819

result:

ok single line: '17304301440819'

Test #98:

score: 0
Accepted
time: 103ms
memory: 16764kb

input:

64100 215333613
SZ 917694781
AKIY 674624794
HJX 465394635
BHBF 171106293
AGIH 704183177
BUQN 813509006
BGDJ 582471441
HPF 879222659
QGR 605634729
BNOV 743035142
APRC 920080372
AKET 126428514
LIT 400253611
CJPP 229320056
AMHE 481002090
CENB 448802317
AZHL 717484601
FSJ 504170727
VLJ 190256902
BLNS 63...

output:

22698267369099

result:

ok single line: '22698267369099'

Test #99:

score: 0
Accepted
time: 134ms
memory: 18600kb

input:

85452 270371018
AGHZ 836464708
IXS 435613352
DTZY 392421324
DH 445944321
DRMV 751982406
BEBJ 246401900
OTB 802176471
CHHI 484051409
CKJE 160492785
AMWX 957484285
NDY 946898862
DNNT 301981437
BGDV 750987421
CCDM 714711476
AVUH 944700471
XJL 811470175
AKJP 192481862
ASGZ 117122474
FNK 236472620
DMNA 8...

output:

47973002326800

result:

ok single line: '47973002326800'

Test #100:

score: 0
Accepted
time: 141ms
memory: 19704kb

input:

97050 270428618
BEBD 843724982
BWOS 532148240
BZOU 128525563
XED 700757488
DWXJ 137307739
EGMN 571077800
AZNR 938240468
EDKE 331539171
DOZT 784471633
ALFF 796773872
CYVF 773361886
CHMB 249657165
BVM 800686243
BTRR 348641135
YCM 990656678
CMEL 541992553
CFKK 753335036
NYU 172403822
DRIG 190332155
BCG...

output:

51772738351657

result:

ok single line: '51772738351657'

Test #101:

score: 0
Accepted
time: 121ms
memory: 17716kb

input:

75678 253030100
ABOA 224480798
COBD 661108454
ARTZ 188178584
AHSH 313214254
BXCM 624245475
IBR 456574120
AOSH 938096974
AZL 126520480
AQFH 921211441
BYUQ 970483620
QTL 107016723
ALQF 324970296
BVMD 272728845
APHJ 198052549
CRJY 610737629
ARW 931314454
CMUK 884886445
EMC 690141038
CPUP 321130445
LXS ...

output:

19549413179928

result:

ok single line: '19549413179928'

Test #102:

score: 0
Accepted
time: 87ms
memory: 15448kb

input:

53311 178758314
ABHL 322312733
AQXN 401841321
BJML 753276524
BD 226138483
BWNC 376003638
WWO 228188442
GBK 445085871
ASWK 926135377
BIQU 854080307
APMI 931594186
BTWD 814123238
AVOE 750394698
CVP 190812561
BOHR 612078812
BJEN 310962191
BBSB 888986962
HHE 102172668
ARKI 409071484
BHRS 465060483
QEJ 8...

output:

32890655981739

result:

ok single line: '32890655981739'

Test #103:

score: 0
Accepted
time: 135ms
memory: 18716kb

input:

83803 273699890
PWT 833397402
AGMY 514583595
AWNS 851626092
AIBM 152589442
BMGU 607113669
AYXK 159963726
ZED 142762052
CZWX 548183034
CFBK 310008068
CYGA 927681445
CAZF 780314087
DFPJ 575187669
AFLC 701182986
XJD 877658834
CQVT 340143385
ALJF 992899156
DMTJ 735852916
AVUF 428236948
CQEP 708040593
DE...

output:

42523562202203

result:

ok single line: '42523562202203'

Test #104:

score: 0
Accepted
time: 100ms
memory: 16712kb

input:

65567 220114477
CONJ 829914914
CBCO 994170812
BTBA 154302756
BSZX 266563690
AQAT 239542936
BQTH 457968415
KCX 803682117
BLWY 205020231
BFTD 799118449
BHWF 105865467
LNE 347233896
MQG 314288233
FIT 717782389
QQI 496407112
BEPD 498696742
QLC 836772137
AIMI 573371848
BTVK 626465663
BIGR 508787102
VPO 3...

output:

34495712381138

result:

ok single line: '34495712381138'

Test #105:

score: 0
Accepted
time: 120ms
memory: 17972kb

input:

78581 264582224
CGTA 175623041
CGYF 821936972
DDIX 859693457
ASQO 502357288
CIDG 746689637
CDLD 478193659
DDZH 220642067
DIJR 596051714
AUEU 992824151
ASMJ 589461717
BNTU 709461708
DTM 439229185
AXZH 665324265
BIAT 215941348
CCPS 846228817
CBUV 476255886
CZPJ 223695423
WBA 213749248
BVBQ 949278582
A...

output:

40063626488601

result:

ok single line: '40063626488601'

Test #106:

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

input:

1 1
X 0
1
X 0

output:

1

result:

ok single line: '1'

Test #107:

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

input:

2 1
Y 10
X 20
2
Y 10
X 20

output:

21

result:

ok single line: '21'

Test #108:

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

input:

1 1
X 0
2
X 0
X 0

output:

2

result:

ok single line: '2'

Test #109:

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

input:

1 1
X 0
2
X 0
X 1

output:

1

result:

ok single line: '1'

Test #110:

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

input:

1 2
X 0
2
X 0
X 1

output:

4

result:

ok single line: '4'

Test #111:

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

input:

1 1
X 1
2
X 0
X 1

output:

4

result:

ok single line: '4'

Test #112:

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

input:

1 1
X 1
2
X 0
X 0

output:

4

result:

ok single line: '4'

Test #113:

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

input:

1 1
X 10
1
X 5

output:

11

result:

ok single line: '11'

Test #114:

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

input:

1 1
X 1
4
X 0
X 1
X 2
X 3

output:

0

result:

ok single line: '0'

Test #115:

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

input:

1 1
X 1
3
X 0
X 1
X 2

output:

4

result:

ok single line: '4'