The single line contains two integers l and r (1 ≤ l ≤ r ≤ 109) — the left and right interval limits.

NoteIn the first sample: next(2) + next(3) + next(4) + next(5) + next(6) + next(7) = 4 + 4 + 4 + 7 + 7 + 7 = 33In the second sample: next(7) = 7

In the single line print the only number — the sum next(l) + next(l + 1) + ... + next(r - 1) + next(r). Please do not use the %lld specificator to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specificator.

Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Let next(x) be the minimum lucky number which is larger than or equals x. Petya is interested what is the value of the expression next(l) + next(l + 1) + ... + next(r - 1) + next(r). Help him solve this problem.

Input: 2 7

Output: 33

Input: 7 7

Output: 7

Input: 1 9

Output: 125

Input: 4 7

Output: 25

Input: 12 47

Output: 1593

Input: 6 77

Output: 4012

Input: 1 100

Output: 14247

Input: 1000000000 1000000000

Output: 4444444444

Input: 77 77

Output: 77

Input: 69 788

Output: 452195

Input: 474 747

Output: 202794

Input: 4 77777

Output: 4070145675

Input: 1 1000000

Output: 1394675359387

Input: 47 744447

Output: 381286992761

Input: 47444 1000000000

Output: 1394672348253941136

Input: 48 854888

Output: 749733199853

Input: 854444 985555

Output: 582719941728

Input: 774744 774747

Output: 3098985

Input: 654 987654

Output: 1339803940266

Input: 477777 1000000000

Output: 1394672167300009765

Input: 77777 777777777

Output: 407018021649898097

Input: 963 85555574

Output: 7526978888069560

Input: 47 7444

Output: 38125896

Input: 1 1000000000

Output: 1394672350065645019

Input: 474 999888555

Output: 1394177038954402791

Input: 777 1000000000

Output: 1394672350065239125

Input: 7 777777774

Output: 407018023386632646

Input: 369 852

Output: 606732

Input: 47 47

Output: 47

Input: 747 748

Output: 1521

Input: 77777440 77777444

Output: 388887220

Input: 987545885 999875584

Output: 54798666661186800

Input: 2 777777776

Output: 407018024942188226

Input: 1 1

Output: 4

Input: 1 2

Output: 8

Input: 999999999 1000000000

Output: 8888888888

Input: 777777777 1000000000

Output: 987654325123456789

Input: 777777778 1000000000

Output: 987654324345679012

Input: 5 6

Output: 14

Input: 49 49

Output: 74

Input: 6 6

Output: 7

Input: 3 4

Output: 8


The single line contains an integer n (1 ≤ n ≤ 1000) — the number that needs to be checked.

NoteNote that all lucky numbers are almost lucky as any number is evenly divisible by itself.In the first sample 47 is a lucky number. In the second sample 16 is divisible by 4.

In the only line print "YES" (without the quotes), if number n is almost lucky. Otherwise, print "NO" (without the quotes).

Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Petya calls a number almost lucky if it could be evenly divided by some lucky number. Help him find out if the given number n is almost lucky.

Output: YES

Output: YES

Output: NO

Output: YES

Output: YES

Output: NO

Output: YES

Output: YES

Output: YES

Output: NO

Output: NO

Output: YES

Output: YES

Output: YES

Output: YES

Output: YES

Output: NO

Output: NO

Output: NO

Output: NO

Output: YES

Output: YES

Output: YES

Output: YES

Output: YES

Output: YES

Output: NO

Output: YES

Output: YES

Output: NO

Output: NO

Output: YES

Output: YES

Output: YES

Output: YES


The single line contains a non-empty string s whose length can range from 1 to 50, inclusive. The string only contains digits. The string can contain leading zeroes.

NoteThe lexicographical comparison of strings is performed by the < operator in the modern programming languages. String x is lexicographically less than string y either if x is a prefix of y, or exists such i (1 ≤ i ≤ min(|x|, |y|)), that xi < yi and for any j (1 ≤ j < i) xj = yj. Here |a| denotes the length of string a.In the first sample three conditions are fulfilled for strings "4", "7" and "47". The lexicographically minimum one is "4".In the second sample s has no substrings which are lucky numbers.In the third sample the three conditions are only fulfilled for string "7".

In the only line print the answer to Petya's problem. If the sought string does not exist, print "-1" (without quotes).

Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.One day Petya was delivered a string s, containing only digits. He needs to find a string that represents a lucky number without leading zeroes, is not empty, is contained in s as a substring the maximum number of times.Among all the strings for which the three conditions given above are fulfilled, Petya only needs the lexicographically minimum one. Find this string for Petya.


The only line contains integers a, b, x1, y1, x2 and y2 — the parameters of the bad squares, the coordinates of the initial and the final squares correspondingly (2 ≤ a, b ≤ 109 and |x1|,|y1|,|x2|,|y2| ≤ 109). It is guaranteed that the initial and the final square aren't bad.

Print a single number — the minimum number of bad cells that one will have to visit in order to travel from square (x1; y1) to square (x2; y2).

You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any square, you can move to any other side-neighboring one. A square (x; y) is considered bad, if at least one of the two conditions is fulfilled: |x + y| ≡ 0 (mod 2a), |x - y| ≡ 0 (mod 2b). Your task is to find the minimum number of bad cells one will have to visit on the way from (x1; y1) to (x2; y2).

Input: 2 2 1 0 0 1

Output: 1

Input: 2 2 10 11 0 1

Output: 5

Input: 2 4 3 -1 3 7

Output: 2

Input: 2 2 9 10 -10 -11

Output: 10

Input: 3 2 -11 -10 10 11

Output: 7

Input: 3 2 11 -12 -12 11

Output: 11

Input: 3 3 12 11 -12 -11

Output: 7

Input: 2 3 -12 13 13 -12

Output: 9

Input: 3 4 -8 5 6 -3

Output: 3

Input: 2 3 2 -1 -10 -1

Output: 3

Input: 4 4 3 2 10 -1

Output: 1

Input: 3 2 -8 -9 -14 -1

Output: 4

Input: 4 4 0 -3 11 -4

Output: 1

Input: 5 3 6 3 3 12

Output: 2

Input: 3 5 -4 -7 5 0

Output: 2

Input: 3 5 -20 19 21 16

Output: 7

Input: 5 6 23 -10 -20 -17

Output: 5

Input: 3 2 8 -25 0 25

Output: 15

Input: 7 7 23 28 -20 -27

Output: 7

Input: 7 7 -30 -29 32 31

Output: 9

Input: 5 8 35 -36 -34 33

Output: 9

Input: 2 9 37 34 -38 -37

Output: 36

Input: 10 8 -44 41 43 -38

Output: 11

Input: 8 9 8 -23 31 -46

Output: 3

Input: 11 10 9 -40 37 -56

Output: 2

Input: 11 5 -71 44 -18 -21

Output: 12

Input: 6 13 -37 12 3 60

Output: 8

Input: 14 9 44 45 -50 -9

Output: 6

Input: 14 16 1967781 241814 1873488 -829353

Output: 41624

Input: 8 12 -14763515 -11730382 -1343471 -4020758

Output: 1320604

Input: 18 17 -26078453 -12853708 26705417 -4593122

Output: 1695679

Input: 5 18 41299309 8851928 -40049166 -35564497

Output: 12576490

Input: 7 20 10771554 -46099323 39192337 54007626

Output: 9180553

Input: 21 24 31005425 54491054 -24732944 -61529693

Output: 4089503

Input: 24 27 -57405669 -65437426 56079726 56139299

Output: 4897128

Input: 17 22 72042304 -75756269 -70969649 64115614

Output: 6429178

Input: 31 29 73305636 76203147 -85238444 -86730133

Output: 5185118

Input: 34 19 -95432112 102651275 96089919 -106537520

Output: 10545022

Input: 26 34 -107153659 6976200 34136365 -95904822

Output: 3590751

Input: 38 5 -13548447 534376 64966608 -29272371

Output: 10832180

Input: 42 45 13921918 62207801 80023961 -85820354

Output: 2379224

Input: 15 11 -140506021 21571904 -148280972 64286933

Output: 2294999

Input: 53 50 -120558789 -138770904 4229051 102239338

Output: 3450925

Input: 29 54 16062290 129524399 -84381788 132177911

Output: 1686044

Input: 12 63 100712190 36906101 87205943 82885374

Output: 1353043

Input: 66 39 -170201625 -169447104 166170410 181151513

Output: 5204323

Input: 72 75 182000846 -19533501 -166922752 -142084479

Output: 3274129

Input: 55 22 189761193 -192020216 -153412991 188486816

Output: 16447301

Input: 86 84 -65173069 221707138 155388823 -224274366

Output: 3967520

Input: 77 101 -241379320 -196400933 220541904 214436435

Output: 5667263

Input: 70 110 221139524 -236077945 -236283510 205078897

Output: 4084454

Input: 18 116 231579605 226020224 -214399491 -217631436

Output: 24711966

Input: 133 122 -258888058 250173335 258738451 -242389122

Output: 4140119

Input: 127 88 66407013 205897916 133496817 264883406

Output: 496360

Input: 146 157 261464154 113810381 214579048 -202712885

Output: 1244549

Input: 148 163 -62225702 -294347345 -98578232 214557359

Output: 1672568

Input: 7 179 -249546082 207791883 267735483 49881404

Output: 25669363

Input: 125 204 91089644 83192699 -300075653 54365352

Output: 1679971

Input: 216 218 15106122 259371253 296596165 -45704666

Output: 1345335

Input: 207 226 -194940280 130461973 246251465 260969752

Output: 1380917

Input: 267 263 -291849914 -111930623 344642355 250706518

Output: 1871029

Input: 288 40 338359015 273791206 -341021431 56950660

Output: 5781749

Input: 321 30 46954660 -343679003 -37851471 373573736

Output: 13367648

Input: 356 10 97627462 341324361 -132835544 -334849729

Output: 22285554

Input: 380 397 -340890121 -349529418 396652406 353599055

Output: 1895619

Input: 388 113 366011910 -387447751 -403158698 353327235

Output: 6681175

Input: 465 469 376765675 358805048 -390193085 -375070460

Output: 1613801

Input: 504 116 -408147784 387006943 367365902 -415105789

Output: 6800114

Input: 509 565 14560229 -77153392 -340426524 82224911

Output: 455190

Input: 605 297 -251700323 -366763764 -445828791 325081312

Output: 1491538

Input: 689 635 344525358 -321493413 12979458 -353392841

Output: 263749

Input: 664 408 -151206136 -299481355 -385233545 310492602

Output: 1034315

Input: 783 827 -98613981 316213558 -275430891 455234090

Output: 190954

Input: 899 549 -249681750 38465319 105189786 -64009701

Output: 416527

Input: 868 969 245648369 212586392 258298826 -389155385

Output: 339339

Input: 1005 557 -451917708 -32771965 501646713 -357583032

Output: 1147554

Input: 1123 1126 438419485 487688122 -477080698 -185247601

Output: 707229

Input: 1174 901 522498777 -499217148 77740787 519316970

Output: 812037

Input: 1425 1444 516172942 520776621 -319341286 -488388923

Output: 647256

Input: 1576 15 -503228573 -531048974 531411118 557082183

Output: 1783049

Input: 1147 1627 473801348 -494462579 -514604760 486124951

Output: 605100

Input: 1811 1038 526157767 549399960 -479125660 -508887739

Output: 569733

Input: 2033 1908 -480144210 482795119 496763189 -594064604

Output: 538199

Input: 86 1341 -197343715 13981506 -529124963 208152056

Output: 800062

Input: 2455 2436 -335351804 -50788097 286734045 222304974

Output: 182317

Input: 2571 2243 474188235 -306739018 48936920 -83297677

Output: 144603

Input: 1558 2911 -239080974 -489789417 369291826 -67795521

Output: 330670

Input: 2795 3024 418200485 -575735266 101404272 -10209857

Output: 145887

Input: 3341 3479 481143880 -383576301 -584637231 166949262

Output: 232295

Input: 3868 1251 -639544998 21536679 -480078735 -457166436

Output: 255064

Input: 4260 4286 -559966975 430515446 630949753 -403746792

Output: 236255

Input: 4685 84 597126772 174658367 -667031403 657366658

Output: 10398014

Input: 5099 3763 239091250 -689089763 -331708609 690647436

Output: 259173

Input: 5431 5421 218916782 582895951 714645533 -634539842

Output: 158012

Input: 5989 6249 -605686335 -602992500 586207791 624769222

Output: 202009

Input: 4238 464 631928630 -699088687 -665579317 658247096

Output: 2860823

Input: 7368 7243 646513016 723552175 -631585348 -678824351

Output: 181900

Input: 6929 8303 -718092932 630511765 717136401 -678221530

Output: 165239

Input: 551 8823 -644698584 720097649 -746775493 -719362914

Output: 1398855

Input: 2036 9146 46737913 478540414 -603176411 -34978692

Output: 285715

Input: 10000 10002 96487781 -692179874 182133670 357089051

Output: 56746

Input: 4209 7951 232804958 -326325341 -138865076 516216059

Output: 76356

Input: 10005 10008 -234169778 -592210597 -126329886 -812018105

Output: 16370

Input: 8387 10012 -275798799 489020846 127010938 154401541

Output: 36828

Input: 10058 9799 -25054219 -611037250 172201377 486371190

Output: 64360

Input: 10088 6166 -735339950 -111273129 787180186 -439981865

Output: 150116

Input: 10311 10242 764996339 626041956 -740573838 -97126465

Output: 108076

Input: 10067 8186 -736794579 -820525762 -407728461 839527984

Output: 98794

Input: 10721 11225 -767745746 709747051 443545879 -717667636

Output: 117537

Input: 13225 984 -760662977 -854994174 786299019 825465374

Output: 122020

Input: 14699 14675 792934253 -867739654 -737526630 840318203

Output: 110341

Input: 20967 19929 821529452 892087465 -867106029 -836044344

Output: 81480

Input: 43649 46022 -793221994 750708255 871188328 -901390875

Output: 36031

Input: 25706 3236 867426580 143799455 254112907 -287546356

Output: 28116

Input: 222075 201776 -663198106 -381459887 -29690718 -65372649

Output: 2138

Input: 526654 264582 -19827600 -757880279 -903623062 -934193021

Output: 1337

Input: 34483 1001201 -483230679 -24466088 827887504 293189155

Output: 23617

Input: 840853 1638188 -425749679 502946202 -953467908 557484181

Output: 281

Input: 4237214 4640696 -612169083 -326390834 887479529 304518522

Output: 251

Input: 2959011 3049607 253816894 -342369389 610124947 440828496

Output: 192

Input: 31288011 27242802 -934902606 343371553 926119543 -195542560

Output: 44

Input: 6152051 53675778 964821583 85960172 -939564894 755134693

Output: 100

Input: 101304499 148554333 -590787464 -890180401 -117457421 997140710

Output: 12

Input: 134699726 208640218 514309071 801051734 276512437 -803859310

Output: 6

Input: 472555248 417950652 -897989583 -805741694 915661619 800897620

Output: 3

Input: 299386785 573704302 956852511 -973861202 -816995136 989470727

Output: 3

Input: 1000000000 1000000000 871940474 991768763 -914352281 -886310260

Output: 1

Input: 781751245 1000000000 -848188940 813653557 978830633 -825182414

Output: 1

Input: 999999999 1000000000 1000000000 -999999999 -1000000000 999999999

Output: 1

Input: 999999 100000 12345 54321 6789 9876

Output: 0


The only line contains three integers n, a and b (0 ≤ a, b < n ≤ 100).

NoteThe possible positions in the first sample are: 2 and 3 (if we number the positions starting with 1).In the second sample they are 3, 4 and 5.

Print the single number — the number of the sought positions.

Petr stands in line of n people, but he doesn't know exactly which position he occupies. He can say that there are no less than a people standing in front of him and no more than b people standing behind him. Find the number of different positions Petr can occupy.

Input: 3 1 1

Output: 2

Input: 5 2 3

Output: 3

Input: 5 4 0

Output: 1

Input: 6 5 5

Output: 1

Input: 9 4 3

Output: 4

Input: 11 4 6

Output: 7

Input: 13 8 7

Output: 5

Input: 14 5 5

Output: 6

Input: 16 6 9

Output: 10

Input: 20 13 17

Output: 7

Input: 22 4 8

Output: 9

Input: 23 8 14

Output: 15

Input: 26 18 22

Output: 8

Input: 28 6 1

Output: 2

Input: 29 5 23

Output: 24

Input: 32 27 15

Output: 5

Input: 33 11 5

Output: 6

Input: 37 21 15

Output: 16

Input: 39 34 33

Output: 5

Input: 41 27 11

Output: 12

Input: 42 25 16

Output: 17

Input: 45 7 43

Output: 38

Input: 47 16 17

Output: 18

Input: 49 11 37

Output: 38

Input: 51 38 39

Output: 13

Input: 52 29 7

Output: 8

Input: 56 43 12

Output: 13

Input: 58 57 28

Output: 1

Input: 59 12 39

Output: 40

Input: 62 9 52

Output: 53

Input: 63 29 44

Output: 34

Input: 65 30 22

Output: 23

Input: 66 27 38

Output: 39

Input: 71 33 53

Output: 38

Input: 73 14 12

Output: 13

Input: 73 37 35

Output: 36

Input: 76 69 44

Output: 7

Input: 79 25 20

Output: 21

Input: 81 60 20

Output: 21

Input: 81 79 14

Output: 2

Input: 84 0 42

Output: 43

Input: 88 79 8

Output: 9

Input: 90 76 59

Output: 14

Input: 92 2 22

Output: 23

Input: 94 5 88

Output: 89

Input: 94 62 48

Output: 32

Input: 96 22 72

Output: 73

Input: 100 11 88

Output: 89

Input: 100 81 91

Output: 19

Input: 1 0 0

Output: 1


The first line contains integers n and k — the number and digit capacity of numbers correspondingly (1 ≤ n, k ≤ 8). Next n lines contain k-digit positive integers. Leading zeroes are allowed both in the initial integers and the integers resulting from the rearranging of digits.

NoteIn the first sample, if we rearrange the digits in numbers as (3,1,4,2), then the 2-nd and the 4-th numbers will equal 5237 and 2537 correspondingly (they will be maximum and minimum for such order of digits).In the second sample, if we swap the second digits and the first ones, we get integers 100, 99 and 102.

Print a single number: the minimally possible difference between the largest and the smallest number after the digits are rearranged in all integers by the same rule.

You are given n k-digit integers. You have to rearrange the digits in the integers so that the difference between the largest and the smallest number was minimum. Digits should be rearranged by the same rule in all integers.

Input:
6 4
5237
2753
7523
5723
5327
2537

Output: 2700

Input:
3 3
010
909
012

Output: 3

Input:
7 5
50808
36603
37198
44911
29994
42543
50156

Output: 20522

Input:
5 5
61374
74304
41924
46010
09118

Output: 64592

Input:
8 8
68785928
11981277
32480720
72495162
69969623
42118868
64235849
81412116

Output: 52901157

Input:
7 1
1
0
8
5
4
9
8

Output: 9

Input:
3 8
34848224
16307102
25181102

Output: 8612277

Input:
2 8
13633861
68468345

Output: 14445725

Input:
4 4
0950
0634
9264
8684

Output: 3738

Input:
6 5
65777
80932
32260
49089
00936
85557

Output: 41439

Input:
5 6
687443
279213
765651
611680
500192

Output: 258067

Input:
8 6
034753
917195
222679
778596
980006
467267
482763
807481

Output: 647026

Input:
8 6
075967
240855
352399
791547
103244
982259
409866
926586

Output: 491255

Input:
3 1
7
2
9

Output: 7

Input:
6 4
5407
4617
3050
7647
8647
1993

Output: 6474

Input:
8 5
47553
55138
81768
78902
50691
73010
93969
01675

Output: 71123

Input:
8 7
5945843
9094433
0750024
6255984
1784849
7275947
6513944
0145523

Output: 5152379

Input:
8 7
8112819
8982110
5457941
4575033
5203331
7410823
0532182
8151054

Output: 6194602

Input:
8 8
63315032
20587190
05461152
76872565
71177578
53541174
00451913
85740357

Output: 60622457

Input:
2 3
135
725

Output: 4

Input:
7 1
9
5
8
9
7
6
9

Output: 4

Input:
5 3
560
978
543
846
714

Output: 435

Input:
7 2
53
74
84
62
14
77
59

Output: 69

Input:
3 4
0537
2174
5299

Output: 3583

Input:
7 5
13532
16394
97663
73133
22712
58185
65035

Output: 26455

Input:
8 5
07936
07927
46068
99158
90958
41283
59266
87841

Output: 52364

Input:
8 6
867468
695388
700723
444270
545657
178053
315040
554471

Output: 559559

Input:
7 7
6575460
6965366
1912357
7080608
2561692
5209630
0439095

Output: 5917123

Input:
1 2
96

Output: 0

Input:
1 3
289

Output: 0

Input:
1 8
78795220

Output: 0

Input:
8 7
2407792
7023368
2609925
0587109
3543873
6602371
4579875
9893509

Output: 6790457

Input:
4 6
065169
150326
924608
490012

Output: 488134

Input:
4 4
8851
6190
0521
1659

Output: 6596

Input:
4 4
4381
3147
7017
5593

Output: 3690

Input:
8 4
0344
9196
1379
5470
0989
8316
7096
7918

Output: 7801

Input:
1 6
430254

Output: 0

Input:
8 1
4
0
8
5
9
0
4
7

Output: 9

Input:
5 2
60
08
77
66
03

Output: 74

Input:
3 1
9
8
2

Output: 7

Input:
7 2
89
00
59
90
99
22
55

Output: 99

Input:
2 4
7694
6577

Output: 712

Input:
8 8
68785928
11981277
32480720
72495162
69969623
42118868
64235849
81412116

Output: 52901157

Input:
2 7
9183508
9276377

Output: 26912

Input:
5 4
7411
3080
9578
5902
3225

Output: 6498

Input:
3 4
0136
4556
4268

Output: 2134

Input:
6 8
99358096
38390629
71597322
35940809
48949759
66204248

Output: 53570178

Input:
7 2
23
11
88
25
22
45
10

Output: 78

Input:
2 3
834
630

Output: 24

Input:
4 2
87
03
95
23

Output: 48

Input:
2 8
10715643
97664296

Output: 1244714

Input:
6 1
9
3
1
3
4
5

Output: 8

Input:
8 5
47553
55138
81768
78902
50691
73010
93969
01675

Output: 71123

Input:
4 4
7603
0859
5241
7680

Output: 5518

Input:
1 7
4605461

Output: 0

Input:
3 4
3061
3404
6670

Output: 2916

Input:
8 4
1847
0962
3216
0772
6399
3082
7997
0625

Output: 7246

Input:
2 6
834527
764560

Output: 577

Input:
5 6
959808
303464
414335
758650
828038

Output: 486245

Input:
4 1
0
7
5
1

Output: 7

Input:
6 7
4565736
9842969
1412800
6411011
5744909
3791659

Output: 4066781

Input:
4 1
0
7
5
1

Output: 7

Input:
1 3
250

Output: 0

Input:
2 1
2
0

Output: 2

Input:
8 8
96805230
73119021
06552907
86283347
88650846
19155689
37032451
19310120

Output: 53604668

Input:
3 2
64
94
65

Output: 10

Input:
8 4
8008
4983
0295
0353
5838
1960
0270
7144

Output: 7475

Input:
4 8
22025344
54085308
77633421
59238322

Output: 7681556

Input:
5 3
504
878
599
683
083

Output: 615

Input:
5 4
7663
4755
2941
4588
0232

Output: 5346

Input:
6 2
97
57
40
99
22
94

Output: 77

Input:
6 7
4104025
1370353
3472874
5258456
5595923
0279404

Output: 2790148

Input:
8 2
42
86
25
30
27
64
67
38

Output: 61

Input:
5 2
52
22
05
37
74

Output: 51

Input:
2 2
63
50

Output: 13

Input:
6 7
4104025
1370353
3472874
5258456
5595923
0279404

Output: 2790148

Input:
6 2
95
56
06
46
77
51

Output: 62

Input:
3 5
97424
96460
47766

Output: 9536

Input:
2 3
596
246

Output: 35

Input:
3 1
1
2
2

Output: 1

Input:
4 2
87
03
95
23

Output: 48

Input:
7 5
41078
41257
35324
70082
66783
99954
85784

Output: 56901

Input:
8 7
8943041
2427704
3775080
2956111
1345704
0937172
1979973
7081540

Output: 3544246

Input:
6 6
505845
903151
055779
733849
508266
029177

Output: 249045

Input:
4 4
1871
9417
7444
4294

Output: 5368

Input:
2 5
60106
07866

Output: 5224

Input:
3 3
195
860
567

Output: 258

Input:
8 5
68186
57779
78079
47451
69788
82172
75373
50157

Output: 32237

Input:
4 7
5342341
5194611
4032103
8739798

Output: 4056779

Input:
4 8
91401735
53979237
20857777
94594293

Output: 34567247

Input:
1 2
95

Output: 0

Input:
6 4
0443
7108
7211
4287
6439
7711

Output: 5301

Input:
6 7
5794383
4078451
0263676
7682294
7436158
3363189

Output: 3560125

Input:
2 5
07259
51985

Output: 23657

Input:
3 3
624
125
097

Output: 247

Input:
8 1
9
7
6
2
9
6
4
8

Output: 7

Input:
6 3
530
862
874
932
972
157

Output: 442

Input:
3 2
51
39
97

Output: 58

Input:
8 4
4650
1735
4269
8023
0948
9685
3675
6017

Output: 6836

Input:
5 3
168
513
110
386
501

Output: 403

Input:
6 2
01
81
60
27
23
67

Output: 70

Input:
4 4
2759
7250
3572
8067

Output: 2028

Input:
8 5
12658
00588
23491
09985
63973
78517
98187
29863

Output: 68592

Input:
3 1
5
4
2

Output: 3

Input:
7 8
24925537
07626274
77060131
82415056
70422753
60455207
32176884

Output: 54680138

Input:
5 8
94157433
85577189
62547277
11815893
35445851

Output: 15679126

Input:
5 5
31164
27213
17981
48806
01273

Output: 33367

Input:
3 6
743197
172242
635654

Output: 261245

Input:
4 6
760130
653002
902824
380915

Output: 268111

Input:
8 8
83239439
62184887
58968944
39808261
68740623
38480328
81965504
52600488

Output: 44481119

Input:
8 2
99
20
22
39
33
60
54
08

Output: 91

Input:
1 7
3545113

Output: 0

Input:
6 7
3761949
8095136
4875085
5017784
4459097
4354762

Output: 4126934

Input:
6 8
50157346
63836375
03176371
83637145
28631038
18617159

Output: 24702445

Input:
1 5
84932

Output: 0

Input:
4 3
204
515
280
840

Output: 467

Input:
8 2
40
41
02
55
26
52
60
25

Output: 58

Input:
2 5
90526
32565

Output: 586

Input:
4 4
3058
2370
0288
5983

Output: 2972

Input:
6 7
9085507
7716507
1952887
6569746
1900754
9212439

Output: 3180457

Input:
5 2
01
07
63
71
99

Output: 89

Input:
6 4
4505
3672
4248
2783
9780
6579

Output: 4484

Input:
2 3
281
498

Output: 127

Input:
8 5
16966
36762
49579
71703
66646
41125
94022
26623

Output: 66868

Input:
1 6
170086

Output: 0

Input:
4 1
4
2
2
2

Output: 2

Input:
3 8
12418144
74773130
10504811

Output: 22901234

Input:
6 7
3761949
8095136
4875085
5017784
4459097
4354762

Output: 4126934


The only line contains an integer n (1 ≤ n ≤ 10000).

Print two non-negative space-separated integers a and b, where a is the numbers of feet and b is the number of inches.

Lengths are measures in Baden in inches and feet. To a length from centimeters it is enough to know that an inch equals three centimeters in Baden and one foot contains 12 inches.You are given a length equal to n centimeters. Your task is to convert it to feet and inches so that the number of feet was maximum. The result should be an integer rounded to the closest value containing an integral number of inches.Note that when you round up, 1 cm rounds up to 0 inches and 2 cm round up to 1 inch.

Output: 1 2

Output: 0 2

Output: 0 8

Output: 0 0

Output: 0 1

Output: 0 1

Output: 0 1

Output: 0 3

Output: 0 3

Output: 0 4

Output: 0 4

Output: 2 9

Output: 3 4

Output: 5 6

Output: 13 11

Output: 27 9

Output: 34 3

Output: 274 4

Output: 277 9

Output: 277 9

Output: 1 0

Output: 2 0


You are given five integers t1, t2, x1, x2 and t0 (1 ≤ t1 ≤ t0 ≤ t2 ≤ 106, 1 ≤ x1, x2 ≤ 106).

NoteIn the second sample the hot water tap shouldn't be opened, but the cold water tap should be opened at full capacity in order to fill the bath in the quickest way possible.

Print two space-separated integers y1 and y2 (0 ≤ y1 ≤ x1, 0 ≤ y2 ≤ x2).

Bob is about to take a hot bath. There are two taps to fill the bath: a hot water tap and a cold water tap. The cold water's temperature is t1, and the hot water's temperature is t2. The cold water tap can transmit any integer number of water units per second from 0 to x1, inclusive. Similarly, the hot water tap can transmit from 0 to x2 water units per second.If y1 water units per second flow through the first tap and y2 water units per second flow through the second tap, then the resulting bath water temperature will be:Bob wants to open both taps so that the bath water temperature was not less than t0. However, the temperature should be as close as possible to this value. If there are several optimal variants, Bob chooses the one that lets fill the bath in the quickest way possible.Determine how much each tap should be opened so that Bob was pleased with the result in the end.

Input: 10 70 100 100 25

Output: 99 33

Input: 300 500 1000 1000 300

Output: 1000 0

Input: 143 456 110 117 273

Output: 76 54

Input: 10 20 5 5 13

Output: 4 2

Input: 1 3 1999 3444 2

Output: 1999 1999

Input: 100 110 2 2 109

Output: 0 2

Input: 3746 3797 485 485 3747

Output: 450 9

Input: 900000 1000000 50000 50000 960000

Output: 33332 49998

Input: 1 3 100 100 2

Output: 100 100

Input: 1 3 100 100 3

Output: 0 100

Input: 1 1 100 100 1

Output: 100 100

Input: 1 1 1 1 1

Output: 1 1

Input: 10 14 1 1 12

Output: 1 1

Input: 10 14 1 1 13

Output: 0 1

Input: 10 14 1 1 14

Output: 0 1

Input: 10 14 1 1 11

Output: 1 1

Input: 10 14 1 1 10

Output: 1 0

Input: 1 1000000 1000000 1000000 500000

Output: 1000000 999998

Input: 1 1000000 1000000 1000000 2

Output: 999998 1

Input: 1 1000000 1000000 1000000 999999

Output: 1 999998

Input: 3 9 9 2 5

Output: 4 2

Input: 7 9 481 961 9

Output: 0 961

Input: 5 10 6361 6643 9

Output: 1660 6640

Input: 3 10 202534 204124 7

Output: 153093 204124

Input: 4 7 990105 993245 7

Output: 0 993245

Input: 167 6430 3 2 4879

Output: 0 2

Input: 59039 78548 8 5 68239

Output: 5 5

Input: 99065 826220 9 3 659285

Output: 0 3

Input: 973058 995844 1 10 973658

Output: 1 1

Input: 983534 987908 2 7 984750

Output: 2 1

Input: 127873 889327 5550 623544 491743

Output: 4953 4533

Input: 146692 953585 99505 406219 259334

Output: 92031 14932

Input: 61097 812001 384947 188893 662044

Output: 41007 164334

Input: 581106 975502 703094 487920 637713

Output: 675578 113214

Input: 663155 979777 797049 494787 951112

Output: 28665 287957

Input: 129630 805489 631548 761110 577559

Output: 227930 447929

Input: 499637 716156 949694 543785 663905

Output: 156753 492804

Input: 522321 902347 10945 842811 630561

Output: 9052 3605

Input: 285510 831681 329092 849678 821409

Output: 13696 714532

Input: 176902 815637 847541 412251 587604

Output: 228033 410702

Input: 690136 947897 137581 128882 932136

Output: 6612 101523

Input: 122316 918901 393457 621754 907250

Output: 9025 608019

Input: 345903 808776 240052 245730 365687

Output: 231914 10355

Input: 483180 855922 224311 233776 855647

Output: 141 190974

Input: 353408 572330 154358 165573 557017

Output: 11080 147325

Input: 632076 716031 914 915 662639

Output: 856 490

Input: 668704 747356 945 949 696258

Output: 790 426

Input: 463050 509065 994 994 489428

Output: 737 990

Input: 77909 251377 937 952 115397

Output: 798 220

Input: 13612 793764 96 76 398584

Output: 78 76

Input: 1 5 3 5 5

Output: 0 5

Input: 99 99 99 99 99

Output: 99 99

Input: 100 100 100 100 100

Output: 100 100

Input: 1000000 1000000 1000000 1000000 1000000

Output: 1000000 1000000

Input: 1000000 1000000 999999 999998 1000000

Output: 999999 999998

Input: 5 5 5 5 5

Output: 5 5

Input: 10 10 100 100 10

Output: 100 100

Input: 1000 1000 1000 1000 1000

Output: 1000 1000

Input: 10 10 5 5 10

Output: 5 5

Input: 1 2 100 100 2

Output: 0 100

Input: 100 100 1000 1000 100

Output: 1000 1000

Input: 1000 1000000 1000000 1000000 1000000

Output: 0 1000000

Input: 50 100 100 100 100

Output: 0 100

Input: 10 10 20 20 10

Output: 20 20

Input: 1 100000 1000 1 2

Output: 1000 1

Input: 1000 1000000 100000 1000000 1000000

Output: 0 1000000

Input: 1 10 10 10 10

Output: 0 10

Input: 1000000 1000000 50 50 1000000

Output: 50 50

Input: 300 300 1000 1000 300

Output: 1000 1000

Input: 5 5 123 1234 5

Output: 123 1234


You are given the 8 strings whose length equals 8, describing the initial position on the board. The first line represents the top row of the board, the next one — for the second from the top, and so on, the last line represents the bottom row. Each character string matches a single cell board in the appropriate row, and the characters are in the same manner as that of the corresponding cell. If the cell is empty, the corresponding character is ".". If a cell has Maria, then it is represented by character "M". If a cell has Anna, it is represented by the character "A". If a cell has a statue, then the cell is represented by character "S". It is guaranteed that the last character of the first row is always "A", the first character of the last line is always "M". The remaining characters are "." or "S".

If Maria wins, print string "WIN". If the statues win, print string "LOSE".

In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 × 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has several statues. Each statue occupies exactly one square. A square that contains a statue cannot have anything or anyone — neither any other statues, nor Anna, nor Maria.Anna is present on the board as a figurant (she stands still and never moves), and Maria has been actively involved in the game. Her goal is — to come to Anna's square. Maria and statues move in turn, Maria moves first. During one move Maria can go to any adjacent on the side or diagonal cell in which there is no statue, or she can stay in the cell where she is. The statues during their move must go one square down simultaneously, and those statues that were in the bottom row fall from the board and are no longer appeared.At that moment, when one of the statues is in the cell in which the Maria is, the statues are declared winners. At the moment when Maria comes into the cell where Anna has been waiting, Maria is declared the winner.Obviously, nothing depends on the statues, so it all depends on Maria. Determine who will win, if Maria does not make a strategic error.

Input:
.......A
........
........
........
........
........
........
M.......

Output: WIN

Input:
.......A
........
........
........
........
........
SS......
M.......

Output: LOSE

Input:
.......A
........
........
........
........
.S......
S.......
MS......

Output: LOSE

Input:
.......A
........
........
........
........
.SSSSSSS
S.......
M.......

Output: WIN

Input:
.......A
........
........
........
S.......
.SSSSSSS
S.......
M.......

Output: LOSE

Input:
.SSSSSSA
.SSSSSSS
.SSSSSSS
.SSSSSSS
.SSSSSSS
.SSSSSSS
.SSSSSSS
MSSSSSSS

Output: WIN

Input:
.......A
..SSSSSS
........
........
SSS.....
........
........
M.......

Output: WIN

Input:
SSSSSSSA
SSSSSSSS
SSSSSSSS
SSSSSSSS
SSSSSSSS
SSSSSSSS
SSSSSSSS
MSSSSSSS

Output: LOSE

Input:
.......A
........
........
........
.S......
S.......
.S......
M.......

Output: LOSE

Input:
.......A
........
........
........
........
S.......
.S......
M.......

Output: WIN

Input:
SSSSSSSA
......SS
.......S
.......S
.......S
.......S
.......S
M......S

Output: LOSE

Input:
.......A
S.S.S.S.
........
.S.S.S.S
........
S.S.S.S.
........
MS.S.S.S

Output: WIN

Input:
SSSSSSSA
......S.
......S.
.....SS.
....SS..
...SS...
..SS....
MSS.....

Output: LOSE

Input:
.S.....A
..SS....
.S......
SS......
..S.....
S.......
.S......
M.......

Output: WIN

Input:
S..SSSSA
...S.S.S
.SS.SS.S
SS....SS
.S.SSSS.
...S.S.S
..S..S..
MSSSSS.S

Output: WIN

Input:
SSSSSSSA
SS.SSSSS
SSSSSSSS
SSSSSSSS
S..SS.SS
SSSS.SSS
SSSS.SSS
M.SSS.SS

Output: LOSE

Input:
.......A
....S...
...S....
........
S..S..SS
.S....S.
S....S..
M....S.S

Output: WIN

Input:
S..SSSSA
.S..S...
S.S....S
SS..S.S.
SSSS.S..
.SS..SS.
....SS..
MS..S...

Output: LOSE

Input:
...S.SSA
.....S..
SSS....S
...S...S
....SSSS
.S.S...S
..S....S
M..SSSSS

Output: WIN

Input:
S..SS.SA
.SSS.S.S
SS.SSS.S
SSS.S.S.
SS.SSSSS
SSSSSSSS
SSSS.SS.
M.SSS.S.

Output: LOSE

Input:
...SSS.A
.....S..
..S.S.SS
.S.S...S
S.S...S.
....S...
........
M..S.SSS

Output: WIN

Input:
.S.S..SA
.S...S.S
S....S..
...S....
.S.SSSSS
S.....SS
.S.S.SSS
M....S.S

Output: LOSE

Input:
.......A
....S...
........
........
........
........
.S......
M.......

Output: WIN

Input:
SSSS.SSA
SSS.SSSS
SSSSSS.S
SS.SSS.S
SS.S.SS.
SSSS.SS.
SSSS.SSS
MSS.SSS.

Output: LOSE

Input:
SSSS.SSA
SSSSS.SS
SSSS.SSS
SSSSSSSS
SS.SSSSS
SSS.SSSS
SSSSSSSS
MSSS..SS

Output: LOSE

Input:
S.S.S..A
...SSS.S
.SSSSSS.
SS.S..SS
SSSS.SSS
.S.SSS..
SS.SSSSS
MSSSS.S.

Output: LOSE

Input:
SSSSSSSA
SS.SSS.S
SSSSSS.S
SSSSSSSS
SSSSSSSS
SSSSSSS.
SSSSSSSS
M.SSSSSS

Output: LOSE

Input:
...S...A
........
..S..S.S
.S....S.
S.......
..S.S..S
......S.
M..SS..S

Output: WIN

Input:
SSSSSSSA
SSSSSSSS
.SSSSSSS
SSSSSSSS
SSSSSSSS
SSSSS.SS
SSSSSSSS
MSSSSSSS

Output: LOSE

Input:
SSSSSSSA
SSS.SSSS
SSSSSSSS
SSS.SSSS
SSSSSSSS
SSSSSSSS
SSSSSSSS
MSSSS.SS

Output: LOSE

Input:
S.S..SSA
...S.S..
.SS.SSS.
......S.
.S...S..
..S.S..S
..SS..S.
M.SS..SS

Output: WIN

Input:
SSSSSSSA
SSSSSSSS
SSSSSSSS
SSSSSSSS
SSSSSSSS
SSSSSSSS
SSSSSSSS
MSSSSSSS

Output: LOSE

Input:
.....S.A
...S.S..
.....S..
........
........
........
......S.
M....S..

Output: WIN

Input:
.S.S.S.A
.SS.S..S
..S....S
..S.....
SSS.S...
.S....S.
SSSSSS..
M..S....

Output: LOSE

Input:
SSSSS..A
S.SS.SS.
.S.SSS.S
..SSSSS.
.S..S.S.
.SS.S..S
SSS.S...
M..S..S.

Output: LOSE

Input:
.......A
........
........
........
..S....S
........
........
M.......

Output: WIN

Input:
.......A
...S...S
...S....
....S..S
........
S.S...S.
SS......
MS......

Output: LOSE

Input:
S......A
.SS..S..
S....S..
SSS...S.
.SS.SSS.
.S.SS...
..S..S..
M.SS....

Output: LOSE

Input:
.SSSS.SA
.SS.SSS.
..S.SS..
SSSS.SS.
S.S.....
S.S.SSSS
S..SS..S
MS.SS.SS

Output: LOSE

Input:
SSS..SSA
SSSSSSSS
..SS..SS
.S.S.SSS
.SSS.SSS
SSSS.S.S
...SS..S
MS..S.SS

Output: LOSE

Input:
S..SSS.A
S.S.SSSS
SSSSSSSS
...SS...
S.SSSSSS
SS..SS.S
SS..S.S.
MSS..SSS

Output: LOSE

Input:
S.SS.SSA
.S..SSS.
SSS.SSS.
SSSS.SSS
S.SSSSSS
SSSSSSSS
SSSSS.SS
MS.SSSSS

Output: LOSE

Input:
SSS.SSSA
SSS....S
SS...SSS
..SSS..S
S..SS...
SS.SS...
.S..SSSS
M.SSSSSS

Output: LOSE

Input:
SSS.SSSA
SSSSSSSS
SSSSSSSS
SS.SSS.S
SSSSSSSS
SSSSSSSS
SSSSSSSS
MSSSSSSS

Output: LOSE

Input:
SSSSSSSA
........
........
........
........
........
........
M.......

Output: WIN

Input:
.......A
........
SSS.....
........
........
.S......
.S......
MS......

Output: WIN


The first and only line contains three integers: n, m, k (1 ≤ n, m, k ≤ 1000).

NoteTwo ways to play the game are considered different if the final pictures are different. In other words, if one way contains a rectangle that is not contained in the other way.In the first sample Anna, who performs her first and only move, has only one possible action plan — insert a 1 × 1 square inside the given 3 × 3 square.In the second sample Anna has as much as 9 variants: 4 ways to paint a 1 × 1 square, 2 ways to insert a 1 × 2 rectangle vertically, 2 more ways to insert it horizontally and one more way is to insert a 2 × 2 square.

Print the single number — the number of the ways to play the game. As this number can be very big, print the value modulo 1000000007 (109 + 7).

In this task Anna and Maria play the following game. Initially they have a checkered piece of paper with a painted n × m rectangle (only the border, no filling). Anna and Maria move in turns and Anna starts. During each move one should paint inside the last-painted rectangle a new lesser rectangle (along the grid lines). The new rectangle should have no common points with the previous one. Note that when we paint a rectangle, we always paint only the border, the rectangles aren't filled.Nobody wins the game — Anna and Maria simply play until they have done k moves in total. Count the number of different ways to play this game.

Input: 3 3 1

Output: 1

Input: 4 4 1

Output: 9

Input: 6 7 2

Output: 75

Input: 5 5 3

Output: 0

Input: 2 2 1

Output: 0

Input: 999 999 499

Output: 1

Input: 456 876 1000

Output: 0

Input: 3 5 1

Output: 6

Input: 5 7 2

Output: 15

Input: 10 13 3

Output: 77616

Input: 1000 1000 499

Output: 998001

Input: 1000 1000 500

Output: 0

Input: 3 1000 1

Output: 498501

Input: 1000 3 1

Output: 498501

Input: 998 1000 499

Output: 0

Input: 1000 1000 250

Output: 263321201

Input: 999 996 247

Output: 729817056

Input: 86 564 16

Output: 966200617

Input: 711 390 95

Output: 187455436

Input: 963 415 36

Output: 336772492

Input: 356 628 17

Output: 665796305

Input: 214 538 33

Output: 661877504

Input: 840 474 207

Output: 895622621

Input: 589 898 280

Output: 752764170

Input: 227 405 404

Output: 0

Input: 351 286 60

Output: 414370922

Input: 531 131 43

Output: 102593830

Input: 980 811 236

Output: 542553202

Input: 638 119 38

Output: 73514263

Input: 897 301 47

Output: 886904759

Input: 569 191 164

Output: 0

Input: 409 92 105

Output: 0

Input: 307 190 52

Output: 186536168

Input: 354 923 125

Output: 708700715

Input: 705 155 490

Output: 0

Input: 188 413 35

Output: 103598368

Input: 954 950 732

Output: 0

Input: 580 1000 203

Output: 693824000

Input: 104 935 326

Output: 0

Input: 611 229 104

Output: 737450171

Input: 277 939 15

Output: 934000455

Input: 338 949 121

Output: 67858020

Input: 734 917 148

Output: 80695422

Input: 505 380 86

Output: 926905224

Input: 340 124 41

Output: 801948369

Input: 565 606 234

Output: 509636173

Input: 956 926 201

Output: 186215807

Input: 1000 1000 20

Output: 155086097

Input: 1000 1000 1000

Output: 0

Input: 1000 1000 100

Output: 58573582


The first line of the input data contains a word consisting of uppercase and lowercase Latin letters. The word's length is from 1 to 100 characters, inclusive.

Print the result of the given word's processing.

wHAT DO WE NEED cAPS LOCK FOR?Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage. Let's consider that a word has been typed with the Caps lock key accidentally switched on, if:   either it only contains uppercase letters;  or all letters except for the first one are uppercase. In this case we should automatically change the case of all letters. For example, the case of the letters that form words "hELLO", "HTTP", "z" should be changed.Write a program that applies the rule mentioned above. If the rule cannot be applied, the program should leave the word unchanged.

Input: cAPS

Output: Caps

Input: Lock

Output: Lock

Input: cAPSlOCK

Output: cAPSlOCK

Input: CAPs

Output: CAPs

Input: LoCK

Output: LoCK

Input: OOPS

Output: oops

Input: oops

Output: oops

Input: a

Output: A

Input: A

Output: a

Input: aA

Output: Aa

Input: Zz

Output: Zz

Input: Az

Output: Az

Input: zA

Output: Za

Input: AAA

Output: aaa

Input: AAa

Output: AAa

Input: AaR

Output: AaR

Input: Tdr

Output: Tdr

Input: aTF

Output: Atf

Input: fYd

Output: fYd

Input: dsA

Output: dsA

Input: fru

Output: fru

Input: hYBKF

Output: Hybkf

Input: XweAR

Output: XweAR

Input: mogqx

Output: mogqx

Input: eOhEi

Output: eOhEi

Input: nkdku

Output: nkdku

Input: zcnko

Output: zcnko

Input: lcccd

Output: lcccd

Input: vwmvg

Output: vwmvg

Input: lvchf

Output: lvchf

Input: IUNVZCCHEWENCHQQXQYPUJCRDZLUXCLJHXPHBXEUUGNXOOOPBMOBRIBHHMIRILYJGYYGFMTMFSVURGYHUWDRLQVIBRLPEVAMJQYO

Output: iunvzcchewenchqqxqypujcrdzluxcljhxphbxeuugnxooopbmobribhhmirilyjgyygfmtmfsvurgyhuwdrlqvibrlpevamjqyo

Input: OBHSZCAMDXEJWOZLKXQKIVXUUQJKJLMMFNBPXAEFXGVNSKQLJGXHUXHGCOTESIVKSFMVVXFVMTEKACRIWALAGGMCGFEXQKNYMRTG

Output: obhszcamdxejwozlkxqkivxuuqjkjlmmfnbpxaefxgvnskqljgxhuxhgcotesivksfmvvxfvmtekacriwalaggmcgfexqknymrtg

Input: IKJYZIKROIYUUCTHSVSKZTETNNOCMAUBLFJCEVANCADASMZRCNLBZPQRXESHEEMOMEPCHROSRTNBIDXYMEPJSIXSZQEBTEKKUHFS

Output: ikjyzikroiyuucthsvskztetnnocmaublfjcevancadasmzrcnlbzpqrxesheemomepchrosrtnbidxymepjsixszqebtekkuhfs

Input: cTKDZNWVYRTFPQLDAUUNSPKTDJTUPPFPRXRSINTVFVNNQNKXWUZUDHZBUSOKTABUEDQKUIVRTTVUREEOBJTSDKJKVEGFXVHXEYPE

Output: Ctkdznwvyrtfpqldauunspktdjtuppfprxrsintvfvnnqnkxwuzudhzbusoktabuedqkuivrttvureeobjtsdkjkvegfxvhxeype

Input: uCKJZRGZJCPPLEEYJTUNKOQSWGBMTBQEVPYFPIPEKRVYQNTDPANOIXKMPINNFUSZWCURGBDPYTEKBEKCPMVZPMWAOSHJYMGKOMBQ

Output: Uckjzrgzjcppleeyjtunkoqswgbmtbqevpyfpipekrvyqntdpanoixkmpinnfuszwcurgbdpytekbekcpmvzpmwaoshjymgkombq

Input: KETAXTSWAAOBKUOKUQREHIOMVMMRSAEWKGXZKRASwTVNSSFSNIWYNPSTMRADOADEEBURRHPOOBIEUIBGYDJCEKPNLEUCANZYJKMR

Output: KETAXTSWAAOBKUOKUQREHIOMVMMRSAEWKGXZKRASwTVNSSFSNIWYNPSTMRADOADEEBURRHPOOBIEUIBGYDJCEKPNLEUCANZYJKMR

Input: ZEKGDMWJPVUWFlNXRLUmWKLMMYSLRQQIBRWDPKWITUIMZYYKOEYGREKHHZRZZUFPVTNIHKGTCCTLOKSZITXXZDMPITHNZUIGDZLE

Output: ZEKGDMWJPVUWFlNXRLUmWKLMMYSLRQQIBRWDPKWITUIMZYYKOEYGREKHHZRZZUFPVTNIHKGTCCTLOKSZITXXZDMPITHNZUIGDZLE

Input: TcMbVPCFvnNkCEUUCIFLgBJeCOKuJhIGwXFrhAZjuAhBraMSchBfWwIuHAEbgJOFzGtxDLDXzDSaPCFujGGxgxdlHUIQYRrMFCgJ

Output: TcMbVPCFvnNkCEUUCIFLgBJeCOKuJhIGwXFrhAZjuAhBraMSchBfWwIuHAEbgJOFzGtxDLDXzDSaPCFujGGxgxdlHUIQYRrMFCgJ

Input: xFGqoLILNvxARKuIntPfeukFtMbvzDezKpPRAKkIoIvwqNXnehRVwkkXYvuRCeoieBaBfTjwsYhDeCLvBwktntyluoxCYVioXGdm

Output: xFGqoLILNvxARKuIntPfeukFtMbvzDezKpPRAKkIoIvwqNXnehRVwkkXYvuRCeoieBaBfTjwsYhDeCLvBwktntyluoxCYVioXGdm

Input: udvqolbxdwbkijwvhlyaelhynmnfgszbhgshlcwdkaibceqomzujndixuzivlsjyjqxzxodzbukxxhwwultvekdfntwpzlhhrIjm

Output: udvqolbxdwbkijwvhlyaelhynmnfgszbhgshlcwdkaibceqomzujndixuzivlsjyjqxzxodzbukxxhwwultvekdfntwpzlhhrIjm

Input: jgpwhetqqoncighgzbbaLwwwxkxivuwtokehrgprfgewzcwxkavwoflcgsgbhoeamzbefzoonwsyzisetoydrpufktzgbaycgaeg

Output: jgpwhetqqoncighgzbbaLwwwxkxivuwtokehrgprfgewzcwxkavwoflcgsgbhoeamzbefzoonwsyzisetoydrpufktzgbaycgaeg

Input: vyujsazdstbnkxeunedfbolicojzjpufgfemhtmdrswvmuhoivjvonacefqenbqudelmdegxqtbwezsbydmanzutvdgkgrjxzlnc

Output: vyujsazdstbnkxeunedfbolicojzjpufgfemhtmdrswvmuhoivjvonacefqenbqudelmdegxqtbwezsbydmanzutvdgkgrjxzlnc

Input: pivqnuqkaofcduvbttztjbuavrqwiqrwkfncmvatoxruelyoecnkpqraiahumiaiqeyjapbqyrsxcdgjbihivtqezvasfmzntdfv

Output: pivqnuqkaofcduvbttztjbuavrqwiqrwkfncmvatoxruelyoecnkpqraiahumiaiqeyjapbqyrsxcdgjbihivtqezvasfmzntdfv

Input: upvtbsxswbohxshdrbjxcungzquhuomgxwlryvshshsfvqbrxvcikbglietlpqkiwbhiqpmdwuqosbtdvyxekkaqiwrbsibpoect

Output: upvtbsxswbohxshdrbjxcungzquhuomgxwlryvshshsfvqbrxvcikbglietlpqkiwbhiqpmdwuqosbtdvyxekkaqiwrbsibpoect

Input: JEGDOFJOFGJHFROGHOFGMHOFGHORGFHMOu

Output: JEGDOFJOFGJHFROGHOFGMHOFGHORGFHMOu

Input: aBACABa

Output: aBACABa

Input: AAAAAAAAAAAAAAAAAAAAAAAAaa

Output: AAAAAAAAAAAAAAAAAAAAAAAAaa

Input: aaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Output: aaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Input: dDDDDDDDDDDDDD

Output: Dddddddddddddd

Input: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Output: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Input: z

Output: Z

Input: AZ

Output: az

Input: Z

Output: z

Input: aAAAA

Output: Aaaaa

Input: F

Output: f


The only line of the input data contains three integers n, m, t (4 ≤ n ≤ 30, 1 ≤ m ≤ 30, 5 ≤ t ≤ n + m).

Find the required number of ways. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specificator.

There are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors containing no less than 4 boys and no less than one girl. How many ways are there to choose a group? Of course, the variants that only differ in the composition of the troupe are considered different.Perform all calculations in the 64-bit type: long long for С/С++, int64 for Delphi and long for Java.

Input: 5 2 5

Output: 10

Input: 4 3 5

Output: 3

Input: 4 1 5

Output: 1

Input: 7 3 6

Output: 168

Input: 30 30 30

Output: 118264581548187697

Input: 10 10 8

Output: 84990

Input: 10 10 10

Output: 168229

Input: 10 10 20

Output: 1

Input: 20 15 27

Output: 23535820

Input: 20 20 40

Output: 1

Input: 20 20 24

Output: 62852101650

Input: 4 20 20

Output: 4845

Input: 4 20 24

Output: 1

Input: 20 3 23

Output: 1

Input: 20 1 21

Output: 1

Input: 20 1 5

Output: 4845

Input: 20 20 5

Output: 96900

Input: 30 30 60

Output: 1

Input: 30 30 59

Output: 60

Input: 30 29 55

Output: 455126

Input: 30 29 59

Output: 1

Input: 4 30 34

Output: 1

Input: 30 1 20

Output: 54627300

Input: 30 1 31

Output: 1

Input: 29 30 57

Output: 1711

Input: 25 30 40

Output: 11899700525790

Input: 4 2 6

Output: 1

Input: 5 1 6

Output: 1

Input: 30 30 50

Output: 75394027566

Input: 30 30 57

Output: 34220

Input: 30 30 58

Output: 1770

Input: 25 25 48

Output: 1225

Input: 30 1 30

Output: 30

Input: 28 28 50

Output: 32468436

Input: 28 28 55

Output: 56

Input: 30 30 55

Output: 5461512

Input: 7 30 37

Output: 1

Input: 10 1 11

Output: 1

Input: 10 1 6

Output: 252


The first line of input contains a string commands — the original list of commands. The string commands contains between 1 and 100 characters, inclusive, and contains only characters "T" and "F". The second line contains an integer n (1 ≤ n ≤ 50) — the number of commands you have to change in the list.

NoteIn the first example the best option is to change the second command ("T") to "F" — this way the turtle will cover a distance of 2 units.In the second example you have to change two commands. One of the ways to cover maximal distance of 6 units is to change the fourth command and first or last one.

Output the maximum distance from the starting point to the ending point of the turtle's path. The ending point of the turtle's path is turtle's coordinate after it follows all the commands of the modified list.

A lot of people associate Logo programming language with turtle graphics. In this case the turtle moves along the straight line and accepts commands "T" ("turn around") and "F" ("move 1 unit forward").You are given a list of commands that will be given to the turtle. You have to change exactly n commands from the list (one command can be changed several times). How far from the starting point can the turtle move after it follows all the commands of the modified list?

Input:
FT
1

Output: 2

Input:
FFFTFFF
2

Output: 6

Input:
F
1

Output: 0

Input:
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
50

Output: 100

Input:
FTFTFTFFFFTFTFTTTTTTFFTTTTFFTFFFTFTFTFFTFTFTFFFTTTFTTFTTTTTFFFFTTT
12

Output: 41

Input:
TTFFTFTTFTTTFFFTFTFFTFFTTFFTFTFTFTFFTTTFTFFTFFTTTTFTTTFFT
46

Output: 57

Input:
TTFFFFFFFTTTTFTTFTFFTTFFFTFTTTFFFFTFFFTFTTTFTTF
24

Output: 47

Input:
FFTTFTTFFFTFFFFTFTTFFTTFTFFFTFFTFTFTTT
46

Output: 37

Input:
FFTFTTFTFTFTFFTTFTFFTFTFTTTT
1

Output: 6

Input:
TFFTTFTFFTFFTTTTFTF
19

Output: 18

Input:
TTFFFFTTF
22

Output: 9

Input:
FTFTFFFTTTFFTTTFTTFTTTFTTTTFTTFFFTFTFTFTFFFTFTFFTTTFFTFTFTFTTFTTTTFFTTTTTFFFFTFTTFFTFFFTTTFFTFF
18

Output: 61

Input:
FTTFTTTFTTFFFTFFTTFTFTTTFFFTFTFTFFTTTFFFFFFTFTTFFTFFFFTFTTFFFTFFTTTTTFFTFTTFFFTFFTFFTF
16

Output: 61

Input:
TFFTFTTTFFTFTFTTTFFTTFFTFTFFTFFFFTTTTTFTFTFTTFFTTFTFFTTFTFFTTTTFFTFTTTFTTTTFFFFTFFTFFTFFFFTTTT
2

Output: 19

Input:
FTTFFTFFFFTTFFFTFFTTFFTTFFTTFFFTTFFTFTFTTFTFFTTTFTTFTTFTFFFFTFTFTFFFFFTTFTFFTTTFFFTF
50

Output: 83

Input:
FTTTTTFTTTTFTFFTFFFTTTTTTTTFTTFFTTTTFFTFTFTFFTFTFTTFTFTFTFFTFTFTFFTFFTTTTTT
4

Output: 20

Input:
TTTFTFTTTFTTFFTFFFFTTTFFFFTTFTFTFFFTTTTFFTTTFFTFTFTFFTTTFFTTFFTFT
27

Output: 58

Input:
TFFTFFFFTFFFTFFFFFTFFFFFFTFFTTTTFFTTFTTTFFTTFFFFTTFFTFFF
42

Output: 56

Input:
FFFFTTTTTTFTFFTFFFTFTFTFTFFTFFTFFTFTTFTTTFFFTF
48

Output: 45

Input:
FFFTTTFTTFFTTFFFTFFFFFTTFTFFTFTTTFFT
48

Output: 36

Input:
TTTTFFTFTFFFFTTFTFTFTTTTFFF
43

Output: 26

Input:
TTTFFFFTTTFTFTFFT
50

Output: 16

Input:
FTFTTFTF
38

Output: 8

Input:
TFTFFTFTTFFTTTTTTFTFTTFFTTTTTFTFTFTTFFTTFTTTFT
11

Output: 28

Input:
FFTTTFTFTFFFFTTTFFTFTFTFTFFFFFTTFTFT
10

Output: 30

Input:
TFFFTFFFTTFTTTFTFFFFFFTTFTF
10

Output: 26

Input:
TTFFFTTTTFFFFTTTF
34

Output: 16

Input:
FTTTFTFF
8

Output: 8

Input:
FTTFTFFTFTTTFTTFTFFTTFFFFFTFFFFTTFTFFFFFFTFFTTTFTTFTTTFFFTFTFTFFFFTFFTFTTTTTTTTFTTTTTTFFTTFTTT
35

Output: 80

Input:
TFTTFFTTFFTFTTFFTFFTTFTFTTTTTFFFFTFFTTFTTTFFTFTTFFFFTFTTTTFFFFTTTFTFTFTTFTFTFTFTTFTF
26

Output: 66

Input:
TFFFFFFFFFTTFTTFTFTFFFTFTFTTFTFTFFTFTTFTTFTTFFFTTFTFFFFFTFTFFTFTFFTTTTFTTFT
13

Output: 54

Input:
FFFTTTTTFTTFTTTFTFTFTTFTFTTFTTFTTTFFFFFFFFTTFTTTTTTFTTFFFFTTFTFFF
6

Output: 32

Input:
FTTFTTFFFFFTTFFFTFFFFTFTTFFTFTFFTFTFTTTFFTTFFTFTFTTFFFTT
47

Output: 56

Input:
FTFFTFTTFFTFTFFTTTTTFTFTFTFFFFTTFTTFTFTTTFTTFFFFFFTFTFTFFFTFTT
10

Output: 38

Input:
FFFTTTFTFTTTFFTTFTTTTTFFFFFTTFTFTFFFFTFFFFFTTTTFFFTF
21

Output: 47

Input:
TFTFFTTFFTTFTFFTFTFTFFTFTTTFFTTTTTTFTFFTFTF
27

Output: 43

Input:
TFTTFFFTFFTTFFTTFTTFTFTFFFTTFTTTF
4

Output: 20

Input:
FTTFTFTFFTTTTFFTFTTFTTFT
24

Output: 24

Input:
TTFTTTFFFTFFFF
36

Output: 14

Input:
TTFFF
49

Output: 4

Input:
FFTFTTFFTTFFFFFFTTTTFFTFFTFFFTTTTTTTTTTFFFTFFTFTFFTTTTTFFFFTTTFFFFTFFFFFTTTFTTFFFTFTFTTTFFT
40

Output: 87

Input:
FFTTTFFTTTFTTFTFTTFTTFTFTFFTTTTFFFFTFFTFTTFTFFTTTTTTFFTTFFFTTFTTFFTTTTTFFTFFTFTTT
1

Output: 16

Input:
TFTFFFTTTFFFFFFFTTFTTTFFFTTFFTTTFTTTFTTTTTFTTFFFTTTTTTFFTFFFFTFFTFTFTFFT
4

Output: 29

Input:
FTTTTTFTFFTTTFFTTFTFFTFTTFTTFFFTTFTTTFFFFFFFTFFTTTTFFTTTFFFFFTFFFFFFFFTFTTFTFT
6

Output: 40

Input:
TTTFFFTTFTFFFTTTFFFFTTFTTTTFTFFFFTFTTTFTTTFTTFTTFFTFTFTFTFFTTFTFTFTT
41

Output: 68

Input:
TFTTFFFFFFFTTTFTFFFTTTFTFFFTFTFTFFFTFTFTTTFTTFFTFTTFTFFTFTF
8

Output: 34

Input:
FFFFTTTTTFFFFTTTFFTTFFTFTTFFTTFFFTTTTFTFFFTFTTFTT
43

Output: 49

Input:
FFFFTTFFTTFFTTFTFFTTTFTFTFFTFTFTTFFTFTTF
41

Output: 40

Input:
TTTTFTTFTFFTFTTTTFFTFTFFFTFFTF
24

Output: 30

Input:
TTTFFFFTTFTFTTTTTFTFF
30

Output: 21

Input:
FTTTTFTFTTT
31

Output: 10

Input:
FFFFTTFTTTTFTTTFTFFFFFTTFFTFFTFFTTFTTFFTFTFTTTTFFFTFTTTFTFTFFTFFFTFTFFFFFFFFFTFFTTFFFFFFTFFFFFTTT
18

Output: 75

Input:
TFFTFTTTTFTTFTFFTFTFTFTTTTTTTTFTTFTTFTFTTFFTTTFFTTTFFTTTTFTFTFFTTTTTFTTFTFTFTTTTFFFTTFTF
45

Output: 78

Input:
TTFFFFFFTFFFFTFFTFTTTFTFFFFFFFTFFTTFFFTFFFFFTTFFFTTTTFFFFFTFFFTTFTFFTTTTFFFFTFTTTFTFTTTTFFTFTF
44

Output: 94

Input:
TFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTF
25

Output: 51

Input:
TFFFTTFFF
2

Output: 8

Input:
TFFFTTTFFFFTFFTTFTTFTTFFTFFFTTTTTTFTTTTTTFFFFFFFTFFFFTTTFTFFTTTTTTFFFFFTTFTFTFFFTFTTFFTTFFFTTFFFTTTT
1

Output: 17

Input:
TFFFFFTFFFFF
1

Output: 11

Input:
FFFFTFTF
1

Output: 5


The input will consist of a single line p which will give a program in HQ9+. String p will contain between 1 and 100 characters, inclusive. ASCII-code of each character of p will be between 33 (exclamation mark) and 126 (tilde), inclusive.

NoteIn the first case the program contains only one instruction — "H", which prints "Hello, World!".In the second case none of the program characters are language instructions.

Output "YES", if executing the program will produce any output, and "NO" otherwise.

HQ9+ is a joke programming language which has only four one-character instructions: "H" prints "Hello, World!", "Q" prints the source code of the program itself, "9" prints the lyrics of "99 Bottles of Beer" song,  "+" increments the value stored in the internal accumulator.Instructions "H" and "Q" are case-sensitive and must be uppercase. The characters of the program which are not instructions are ignored.You are given a program written in HQ9+. You have to figure out whether executing this program will produce any output.

Input: Hi!

Output: YES

Input: Codeforces

Output: NO

Input: a+b=c

Output: NO

Input: hq-lowercase

Output: NO

Input: Q

Output: YES

Output: YES

Input: H

Output: YES

Output: NO

Output: NO

Input: dEHsbM'gS[\brZ_dpjXw8f?L[4E"s4Zc9*(,j:>p$}m7HD[_9nOWQ\uvq2mHWR

Output: YES

Output: YES

Output: NO

Input: juq)k(FT.^G=G\zcqnO"uJIE1_]KFH9S=1c"mJ;F9F)%>&.WOdp09+k`Yc6}"6xw,Aos:M\_^^:xBb[CcsHm?J

Output: YES

Input: 6G_"Fq#<AWyHG=Rci1t%#Jc#x<Fpg'N@t%F=``YO7\Zd;6PkMe<#91YgzTC)

Output: YES

Output: YES

Input: p-UXsbd&f

Output: NO

Input: <]D7NMA)yZe=`?RbP5lsa.l_Mg^V:"-0x+$3c,q&L%18Ku<HcA\s!^OQblk^x{35S'>yz8cKgVHWZ]kV0>_

Output: YES

Input: f.20)8b+.R}Gy!DbHU3v(.(=Q^`z[_BaQ}eO=C1IK;b2GkD\{\Bf"!#qh]

Output: YES

Output: YES

Input: Iy^.,Aw*,5+f;l@Q;jLK'G5H-r1Pfmx?ei~`CjMmUe{K:lS9cu4ay8rqRh-W?Gqv!e-j*U)!Mzn{E8B6%~aSZ~iQ_QwlC9_cX(o8

Output: YES

Input: sKLje,:q>-D,;NvQ3,qN3-N&tPx0nL/,>Ca|z"k2S{NF7btLa3_TyXG4XZ:`(t&"'^M|@qObZxv

Output: YES

Input: %z:c@1ZsQ@\6U/NQ+M9R>,$bwG`U1+C\18^:S},;kw!&4r|z`

Output: YES

Output: NO

Input: y{0;neX]w0IenPvPx0iXp+X|IzLZZaRzBJ>q~LhMhD$x-^GDwl;,a'<bAqH8QrFwbK@oi?I'W.bZ]MlIQ/x(0YzbTH^l.)]0Bv

Output: YES

Input: EL|xIP5_+Caon1hPpQ0[8+r@LX4;b?gMy>;/WH)pf@Ur*TiXu*e}b-*%acUA~A?>MDz#!\Uh

Output: YES

Input: UbkW=UVb>;z6)p@Phr;^Dn.|5O{_i||:Rv|KJ_ay~V(S&Jp

Output: NO

Output: YES

Input: Kba/Q,SL~FMd)3hOWU'Jum{9"$Ld4:GW}D]%tr@G{hpG:PV5-c'VIZ~m/6|3I?_4*1luKnOp`%p|0H{[|Y1A~4-ZdX,Rw2[\

Output: YES

Input: NRN*=v>;oU7[acMIJn*n^bWm!cm3#E7Efr>{g-8bl"DN4~_=f?[T;~Fq#&)aXq%</GcTJD^e$@Extm[e"C)q_L

Output: NO

Input: y#<fv{_=$MP!{D%I\1OqjaqKh[pqE$KvYL<9@*V'j8uH0/gQdA'G;&y4Cv6&

Output: YES

Output: YES

Output: NO

Input: !:!{~=9*\P;Z6F?HC5GadFz)>k*=u|+"Cm]ICTmB!`L{&oS/z6b~#Snbp/^\Q>XWU-vY+/dP.7S=-#&whS@,

Output: YES

Input: KimtYBZp+ISeO(uH;UldoE6eAcp|9u?SzGZd6j-e}[}u#e[Cx8.qgY]$2!

Output: YES

Output: YES

Input: 'jdL(vX

Output: NO

Input: Q;R+aay]cL?Zh*uG"YcmO*@Dts*Gjp}D~M7Z96+<4?9I3aH~0qNdO(RmyRy=ci,s8qD_kwj;QHFzD|5,5

Output: YES

Input: {Q@#<LU_v^qdh%gGxz*pu)Y"]k-l-N30WAxvp2IE3:jD0Wi4H/xWPH&s

Output: YES

Input: ~@Gb(S&N$mBuBUMAky-z^{5VwLNTzYg|ZUZncL@ahS?K*As<$iNUARM3r43J'jJB)$ujfPAq"G<S9flGyakZg!2Z.-NJ|2{F>]

Output: YES

Input: Jp5Aa>aP6fZ!\6%A}<S}j{O4`C6y$8|i3IW,WHy&"ioE&7zP"'xHAY;:x%@SnS]Mr{R|})gU

Output: YES

Input: ZA#:U)$RI^sE\vuAt]x"2zipI!}YEu2<j$:H0_9/~eB?#->

Output: YES

Output: NO

Input: P(^pix"=oiEZu8?@d@J(I`Xp5TN^T3\Z7P5"ZrvZ{2Fwz3g-8`U!)(1$a<g+9Q|COhDoH;HwFY02Pa|ZGp$/WZBR=>6Jg!yr

Output: YES

Input: `WfODc\?#ax~1xu@[ao+o_rN|L7%v,p,nDv>3+6cy.]q3)+A6b!q*Hc+#.t4f~vhUa~$^q

Output: YES

Input: ,)TH9N}'6t2+0Yg?S#6/{_.,!)9d}h'wG|sY&'Ul4D0l0

Output: YES

Output: YES

Input: ")1cL>{o\dcYJzu?CefyN^bGRviOH&P7rJS3PT4:0V3F)%\}L=AJouYsj_>j2|7^1NWu*%NbOP>ngv-ls<;b-4Sd3Na0R

Output: YES

Input: 2Y}\A)>row{~c[g>:'.|ZC8%UTQ/jcdhK%6O)QRC.kd@%y}LJYk=V{G5pQK/yKJ%{G3C

Output: YES

Input: O.&=qt(`z(

Output: NO

Input: _^r6fyIc/~~;>l%9?aVEi7-{=,[<aMiB'-scSg$$|"jAzY0N>QkHHGBZj2c"=fhRlWd5;5K|GgU?7h]!;wl@

Output: YES

Input: +/`sAd&eB29E=Nu87${.u6GY@$^a$,}s^!p!F}B-z8<<wORb<S7;HM1a,gp

Output: YES

Output: YES

Output: NO

Input: 1EE*I%EQz6$~pPu7|(r7nyPQt4uGU@]~H'4uII?b1_Wn)K?ZRHrr0z&Kr;}aO3<mN=3:{}QgPxI|Ncm4#)

Output: YES

Input: [u3"$+!:/.<Dp1M7tH}:zxjt],^kv}qP;y12"`^'/u*h%AFmPJ>e1#Yly

Output: YES

Output: NO

Output: YES

Input: aGv7,J@&g1(}E3g6[LuDZwZl2<v7IwQA%"R(?ouBD>_=y"3Kf%^>vON<a^T\G^ootgE@whWmZo=[ex|F

Output: YES

Output: YES

Input: mzbmweyydiadtlcouegmdbyfwurpwbpuvhifnuapwyndmhtqvkgkbhtytszotwflegsjzzszfwtzfpnscguemwrczqxycivdqnkH

Output: YES

Input: Qzbmweyydiadtlcouegmdbyfwurpwbpuvhifnuapwyndmhtqvkgkbhtytszotwflegsjzzszfwtzfpnscguemwrczqxycivdqnky

Output: YES

Output: YES

Output: YES

Input: +Q

Output: YES

Output: NO

Output: NO

Output: NO

Input: +H

Output: YES

Input: cH

Output: YES

Output: NO

Output: NO

Output: NO

Output: NO

Input: H+

Output: YES

Input: a!

Output: NO

Output: NO

Output: NO

Output: NO

Output: NO

Output: YES

Input: +++H

Output: YES

Output: NO

Input: HHHHHHH

Output: YES

Input: abacabaH

Output: YES

Input: +G

Output: NO


The input will consist of a single line p which gives a Brainfuck program. String p will contain between 1 and 100 characters, inclusive. Each character of p will be "+", "-", "[", "]", "<", ">", "." or ",".

NoteTo write a number n in unary numeral system, one simply has to write 1 n times. For example, 5 written in unary system will be 11111.In the first example replacing Brainfuck commands with binary code will give us 1101 1100. After we concatenate the codes, we'll get 11011100 in binary system, or 220 in decimal. That's exactly the number of tokens in the equivalent Unary program.

Output the size of the equivalent Unary program modulo 1000003 (106 + 3).

Unary is a minimalistic Brainfuck dialect in which programs are written using only one token. Brainfuck programs use 8 commands: "+", "-", "[", "]", "<", ">", "." and "," (their meaning is not important for the purposes of this problem). Unary programs are created from Brainfuck programs using the following algorithm. First, replace each command with a corresponding binary code, using the following conversion table:   ">"  →  1000,  "<"  →  1001,  "+"  →  1010,  "-"  →  1011,  "."  →  1100,  ","  →  1101,  "["  →  1110,  "]"  →  1111. Next, concatenate the resulting binary codes into one binary number in the same order as in the program. Finally, write this number using unary numeral system — this is the Unary program equivalent to the original Brainfuck one.You are given a Brainfuck program. Your task is to calculate the size of the equivalent Unary program, and print it modulo 1000003 (106 + 3).


The input contains the only integer n (1 ≤ n ≤ 106).

NoteThe pair (1,1) can be transformed into a pair containing 5 in three moves: (1,1)  →  (1,2)  →  (3,2)  →  (5,2).

Let's assume that we have a pair of numbers (a, b). We can get a new pair (a + b, b) or (a, a + b) from the given pair in a single step.Let the initial pair of numbers be (1,1). Your task is to find number k, that is, the least number of steps needed to transform (1,1) into the pair where at least one number equals n.


The input consists of a single line containing four integers l1, r1, l2, r2 (1 ≤ li ≤ ri ≤ 109, i = 1, 2). The numbers are separated by single spaces. li and ri give the indices of the first and the last characters of the i-th chosen substring, correspondingly (i = 1, 2). The characters of string abracadabra are numbered starting from 1.

NoteIn the first sample the first substring is "acab", the second one is "abac". These two substrings have two longest common substrings "ac" and "ab", but we are only interested in their length — 2.In the second sample the first substring is "a", the second one is "c". These two substrings don't have any common characters, so the length of their longest common substring is 0.

Print a single number — the length of the longest common substring of the given strings. If there are no common substrings, print 0.

Polycarpus analyzes a string called abracadabra. This string is constructed using the following algorithm:   On the first step the string consists of a single character "a".  On the k-th step Polycarpus concatenates two copies of the string obtained on the (k - 1)-th step, while inserting the k-th character of the alphabet between them. Polycarpus uses the alphabet that consists of lowercase Latin letters and digits (a total of 36 characters). The alphabet characters are numbered like this: the 1-st character is "a", the 2-nd — "b", ..., the 26-th — "z", the 27-th — "0", the 28-th — "1", ..., the 36-th — "9". Let's have a closer look at the algorithm. On the second step Polycarpus will concatenate two strings "a" and insert the character "b" between them, resulting in "aba" string. The third step will transform it into "abacaba", and the fourth one - into "abacabadabacaba". Thus, the string constructed on the k-th step will consist of 2k - 1 characters. Polycarpus wrote down the string he got after 30 steps of the given algorithm and chose two non-empty substrings of it. Your task is to find the length of the longest common substring of the two substrings selected by Polycarpus.A substring s[i... j] (1 ≤ i ≤ j ≤ |s|) of string s = s1s2... s|s| is a string sisi + 1... sj. For example, substring s[2...4] of string s = "abacaba" equals "bac". The string is its own substring.The longest common substring of two strings s and t is the longest string that is a substring of both s and t. For example, the longest common substring of "contest" and "systemtesting" is string "test". There can be several common substrings of maximum length.

Input: 3 6 1 4

Output: 2

Input: 1 1 4 4

Output: 0

Input: 2 2 6 6

Output: 1

Input: 73426655 594361930 343984155 989446962

Output: 379149396

Input: 169720415 312105195 670978284 671296539

Output: 207899

Input: 1 1 1 1

Output: 1

Input: 1 1 2 3

Output: 1

Input: 2 3 1 1

Output: 1

Input: 4 5 6 7

Output: 1

Input: 5 6 5 10

Output: 2

Input: 20 59 93 97

Output: 5

Input: 59 797 761 863

Output: 103

Input: 3563 8248 1195 5811

Output: 2901

Input: 26733 47464 19138 46248

Output: 19516

Input: 183307 582175 813247 925985

Output: 112739

Input: 42765 7043311 3930802 8641200

Output: 4151539

Input: 48358214 56090000 19994986 77748608

Output: 7731787

Input: 326428072 910655768 241366302 856438517

Output: 530010446

Input: 1 1000000000 1 1000000000

Output: 1000000000

Input: 601080293 742283208 417827259 630484959

Output: 71194568

Input: 933937636 947664621 406658382 548532154

Output: 8140525

Input: 876260202 917475655 508441743 544698794

Output: 28429169

Input: 260267830 630246217 436204204 880818505

Output: 268435455

Input: 1 463129088 536870913 1000000000

Output: 463129088

Input: 1 463129088 536870914 1000000000

Output: 463129087

Input: 58660225 863918362 315894896 954309337

Output: 548023467

Input: 462616550 929253987 199885647 365920450

Output: 166034804

Input: 166724572 472113234 358126054 528083792

Output: 125430608

Input: 654444727 988815385 77276659 644738371

Output: 334370659

Input: 346539730 828420288 373318830 643522086

Output: 270203257

Input: 156642200 503020953 296806626 871864091

Output: 234585497

Input: 229012373 968585257 177685154 283692208

Output: 106007055

Input: 225343773 292960163 388346281 585652974

Output: 43091683

Input: 760202684 921630809 8799976 434695123

Output: 161428126

Input: 489816019 571947327 244679586 543875061

Output: 54059043

Input: 377544108 461895419 242140460 901355034

Output: 84351312

Input: 293057586 653835431 583814665 643163992

Output: 59349328

Input: 926028190 962292871 588752738 848484542

Output: 36264682

Input: 79844257 998861014 59606735 909001530

Output: 829157274

Input: 656438998 774335411 16384880 470969252

Output: 117896414

Input: 287551411 788248606 147317343 692683069

Output: 405131659

Input: 677764866 754506263 454018800 668014358

Output: 76741398

Input: 1 2 3 6

Output: 2

Input: 1 1 2 1000000000

Output: 1

Input: 5 7 13 15

Output: 3

Input: 1 3 5 7

Output: 3

Input: 1 3 9 11

Output: 3

Input: 5 7 1 3

Output: 3

Input: 1 4 4 7

Output: 3

Input: 4 7 12 15

Output: 4

Input: 1 4 9 12

Output: 4

Input: 4 7 1 4

Output: 3

Input: 3 3 1 2

Output: 1

Input: 1 2 3 3

Output: 1

Input: 3 4 1 2

Output: 1

Input: 8136 12821 10573 15189

Output: 2901

Input: 331458616 472661531 443256865 655914565

Output: 71194568

Input: 156266169 197481622 529043030 565300081

Output: 28429169

Input: 443495607 813473994 192923319 637537620

Output: 268435455

Input: 1 2 2 1000000000

Output: 2

Input: 1 3 4 1000000000

Output: 3

Input: 1 999999999 999999998 1000000000

Output: 3


The input consists of two lines. The first of them contains s (1 ≤ |s| ≤ 5000), and the second one contains t (1 ≤ |t| ≤ 5000). Both strings consist of lowercase Latin letters.

NoteLet's write down all pairs "x y" that form the answer in the first sample: "s[1...1] t[1]", "s[2...2] t[1]", "s[1...1] t[2]","s[2...2] t[2]", "s[1...2] t[1 2]".

Print a single number — the number of different pairs "x y" such that x is a substring of string s, y is a subsequence of string t, and the content of x and y is the same. As the answer can be rather large, print it modulo 1000000007 (109 + 7).

One day Polycarpus got hold of two non-empty strings s and t, consisting of lowercase Latin letters. Polycarpus is quite good with strings, so he immediately wondered, how many different pairs of "x y" are there, such that x is a substring of string s, y is a subsequence of string t, and the content of x and y is the same. Two pairs are considered different, if they contain different substrings of string s or different subsequences of string t. Read the whole statement to understand the definition of different substrings and subsequences.The length of string s is the number of characters in it. If we denote the length of the string s as |s|, we can write the string as s = s1s2... s|s|.A substring of s is a non-empty string x = s[a... b] = sasa + 1... sb (1 ≤ a ≤ b ≤ |s|). For example, "code" and "force" are substrings or "codeforces", while "coders" is not. Two substrings s[a... b] and s[c... d] are considered to be different if a ≠ c or b ≠ d. For example, if s="codeforces", s[2...2] and s[6...6] are different, though their content is the same.A subsequence of s is a non-empty string y = s[p1p2... p|y|] = sp1sp2... sp|y| (1 ≤ p1 < p2 < ... < p|y| ≤ |s|). For example, "coders" is a subsequence of "codeforces". Two subsequences u = s[p1p2... p|u|] and v = s[q1q2... q|v|] are considered different if the sequences p and q are different.

Input:
aa
aa

Output: 5

Input:
codeforces
forceofcode

Output: 60

Input:
coderscontest
codeforces

Output: 39

Input:
a
b

Output: 0

Input:
ab
bbbba

Output: 5

Input:
abbbccbba
abcabc

Output: 33

Input:
zxzxzxzxzxzxzx
d

Output: 0

Output: 550446899

Output: 341610017

Output: 26774278

Output: 8095

Output: 780242047

Output: 775698073

Output: 203619346

Output: 191033243

Output: 292642273

Output: 881800947

Output: 602980364

Output: 745475026

Output: 169

Output: 180

Output: 152527688

Output: 341610017

Input:
ababbabbab
ababb

Output: 75

Input:
bbabb
bababbbbab

Output: 222

Input:
ababababab
ababb

Output: 74

Input:
b
ab

Output: 1

Input:
ab
a

Output: 1

Input:
xzzxxxzxzzzxzzzxxzzxzzxzxzxxzxxzxxzxzzxxzxxzxxxzxzxzxxzzxxxxzxzzzxxxzxzxxxzzxxzxxzxxzzxxzxxzxzxzzzxzzzzxzxxzzxzxxzxxzzxzxzx
zzx

Output: 291

Input:
zxx
xzzxxxxzzzxxxzzxxxzxxxzzxxzxxxzzxzxxzxxzxxzxzxxzxxxxzzxxzzxzzxxzzxxzxzxzxxzxzxzxxxzxxzzxxzxxxxzzxxxzxxxzxzxzzxzzxxxxzzxxzxz

Output: 46917

Output: 304582131

Output: 815673638

Output: 400518608

Output: 676092235

Output: 550446899

Output: 341610017

Output: 26774278

Output: 8095

Output: 780242047

Output: 775698073

Output: 203619346

Output: 191033243

Output: 292642273

Output: 881800947

Output: 602980364

Output: 745475026

Output: 169

Output: 180

Output: 152527688

Output: 341610017

Output: 304582131

Output: 815673638

Output: 400518608

Output: 676092235


The input consists of two integers n and k, separated by spaces — the size of the program in lines and the productivity reduction coefficient, 1 ≤ n ≤ 109, 2 ≤ k ≤ 10.

NoteIn the first sample the answer is v = 4. Vasya writes the code in the following portions: first 4 lines, then 2, then 1, and then Vasya falls asleep. Thus, he manages to write 4 + 2 + 1 = 7 lines in a night and complete the task.In the second sample the answer is v = 54. Vasya writes the code in the following portions: 54, 6. The total sum is 54 + 6 = 60, that's even more than n = 59.

Print the only integer — the minimum value of v that lets Vasya write the program in one night.

One day a highly important task was commissioned to Vasya — writing a program in a night. The program consists of n lines of code. Vasya is already exhausted, so he works like that: first he writes v lines of code, drinks a cup of tea, then he writes as much as  lines, drinks another cup of tea, then he writes  lines and so on: , , , ...The expression  is regarded as the integral part from dividing number a by number b.The moment the current value  equals 0, Vasya immediately falls asleep and he wakes up only in the morning, when the program should already be finished.Vasya is wondering, what minimum allowable value v can take to let him write not less than n lines of code before he falls asleep.

Input: 7 2

Output: 4

Input: 59 9

Output: 54

Input: 1 9

Output: 1

Input: 11 2

Output: 7

Input: 747 2

Output: 376

Input: 6578 2

Output: 3293

Input: 37212 2

Output: 18609

Input: 12357 2

Output: 6181

Input: 7998332 2

Output: 3999172

Input: 86275251 2

Output: 43137632

Input: 75584551 2

Output: 37792280

Input: 6 3

Output: 5

Input: 43 4

Output: 33

Input: 811 3

Output: 543

Input: 3410 4

Output: 2560

Input: 21341 4

Output: 16009

Input: 696485 4

Output: 522368

Input: 8856748 3

Output: 5904504

Input: 2959379 4

Output: 2219538

Input: 831410263 3

Output: 554273516

Input: 2 5

Output: 2

Input: 19 6

Output: 17

Input: 715 7

Output: 615

Input: 9122 5

Output: 7300

Input: 89117 6

Output: 74268

Input: 689973 7

Output: 591408

Input: 3024524 5

Output: 2419624

Input: 67127156 6

Output: 55939302

Input: 412262167 7

Output: 353367574

Input: 6 8

Output: 6

Input: 246 10

Output: 222

Input: 5314 8

Output: 4651

Input: 15309 9

Output: 13609

Input: 35648 10

Output: 32085

Input: 3018012 8

Output: 2640764

Input: 92153348 9

Output: 81914089

Input: 177583558 10

Output: 159825206

Input: 1000000000 2

Output: 500000008

Input: 1000000000 3

Output: 666666672

Input: 1000000000 4

Output: 750000005

Input: 1000000000 5

Output: 800000003

Input: 1000000000 6

Output: 833333338

Input: 1000000000 7

Output: 857142861

Input: 1000000000 8

Output: 875000004

Input: 1000000000 9

Output: 888888894

Input: 1000000000 10

Output: 900000001

Input: 1 4

Output: 1

Input: 2 10

Output: 2

Input: 1 2

Output: 1

Input: 987862820 9

Output: 878100288

Input: 979591791 9

Output: 870748262

Input: 948889213 9

Output: 843457081

Input: 8 9

Output: 8

Input: 999999999 10

Output: 900000000


The first line contains the only integer n (1 ≤ n ≤ 107) — the required length of the cyclic path.

NoteThe required paths in the first sample are:   D - A - D  D - B - D  D - C - D

Print the only integer — the required number of ways modulo 1000000007 (109 + 7).

You are given a tetrahedron. Let's mark its vertices with letters A, B, C and D correspondingly.  An ant is standing in the vertex D of the tetrahedron. The ant is quite active and he wouldn't stay idle. At each moment of time he makes a step from one vertex to another one along some edge of the tetrahedron. The ant just can't stand on one place.You do not have to do much to solve the problem: your task is to count the number of ways in which the ant can go from the initial vertex D to itself in exactly n steps. In other words, you are asked to find out the number of different cyclic paths with the length of n from vertex D to itself. As the number can be quite large, you should print it modulo 1000000007 (109 + 7).


The first line contains three space-separated integers, n, x, y (1 ≤ n, x, y ≤ 104, x ≤ n) — the number of citizens in the city, the number of wizards and the percentage the administration needs, correspondingly. Please note that y can exceed 100 percent, that is, the administration wants to see on a demonstration more people that actually live in the city ( > n).

NoteIn the first sample it is necessary that at least 14% of 10 people came to the demonstration. As the number of people should be integer, then at least two people should come. There is only one wizard living in the city and he is going to come. That isn't enough, so he needs to create one clone. In the second sample 10 people should come to the demonstration. The city has 10 wizards. They will all come to the demonstration, so nobody has to create any clones.

Print a single integer — the answer to the problem, the minimum number of clones to create, so that the demonstration involved no less than y percent of n (the real total city population).

Some country is populated by wizards. They want to organize a demonstration.There are n people living in the city, x of them are the wizards who will surely go to the demonstration. Other city people (n - x people) do not support the wizards and aren't going to go to the demonstration. We know that the city administration will react only to the demonstration involving at least y percent of the city people. Having considered the matter, the wizards decided to create clone puppets which can substitute the city people on the demonstration. So all in all, the demonstration will involve only the wizards and their puppets. The city administration cannot tell the difference between a puppet and a person, so, as they calculate the percentage, the administration will consider the city to be consisting of only n people and not containing any clone puppets. Help the wizards and find the minimum number of clones to create to that the demonstration had no less than y percent of the city people.

Input: 10 1 14

Output: 1

Input: 20 10 50

Output: 0

Input: 1000 352 146

Output: 1108

Input: 68 65 20

Output: 0

Input: 78 28 27

Output: 0

Input: 78 73 58

Output: 0

Input: 70 38 66

Output: 9

Input: 54 4 38

Output: 17

Input: 3 1 69

Output: 2

Input: 11 9 60

Output: 0

Input: 71 49 65

Output: 0

Input: 78 55 96

Output: 20

Input: 2765 768 9020

Output: 248635

Input: 3478 1728 9727

Output: 336578

Input: 9678 6173 5658

Output: 541409

Input: 1138 570 6666

Output: 75290

Input: 7754 204 9038

Output: 700603

Input: 8403 7401 4769

Output: 393339

Input: 4909 2111 8860

Output: 432827

Input: 6571 6449 8965

Output: 582642

Input: 9178 2255 7996

Output: 731618

Input: 6151 6148 3746

Output: 224269

Input: 8890 5449 8734

Output: 771004

Input: 7879 2590 2818

Output: 219441

Input: 8484 6400 547

Output: 40008

Input: 7835 6710 1639

Output: 121706

Input: 2379 1436 9663

Output: 228447

Input: 6487 5670 8

Output: 0

Input: 4470 2543 6

Output: 0

Input: 7261 5328 10

Output: 0

Input: 3871 3795 7

Output: 0

Input: 9620 6557 6

Output: 0

Input: 4890 1112 5

Output: 0

Input: 1 1 1

Output: 0

Input: 1 1 10000

Output: 99

Input: 10000 1 1

Output: 99

Input: 10000 1 10000

Output: 999999

Input: 10000 10000 1

Output: 0

Input: 10000 10000 10000

Output: 990000

Input: 67 1 3

Output: 2

Input: 7878 4534 9159

Output: 717013

Input: 3271 5 50

Output: 1631