One day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya needed no time to realize that the box is special, as all its edges are parallel to the coordinate axes, one of its vertices is at point (0, 0, 0), and the opposite one is at point (x1, y1, z1). The six faces of the box contain some numbers a1, a2, ..., a6, exactly one number right in the center of each face.  The numbers are located on the box like that:   number a1 is written on the face that lies on the ZOX plane;  a2 is written on the face, parallel to the plane from the previous point;  a3 is written on the face that lies on the XOY plane;  a4 is written on the face, parallel to the plane from the previous point;  a5 is written on the face that lies on the YOZ plane;  a6 is written on the face, parallel to the plane from the previous point. At the moment Vasya is looking at the box from point (x, y, z). Find the sum of numbers that Vasya sees. Note that all faces of the box are not transparent and Vasya can't see the numbers through the box. The picture contains transparent faces just to make it easier to perceive. You can consider that if Vasya is looking from point, lying on the plane of some face, than he can not see the number that is written on this face. It is enough to see the center of a face to see the corresponding number for Vasya. Also note that Vasya always reads correctly the ai numbers that he sees, independently of their rotation, angle and other factors (that is, for example, if Vasya sees some ai = 6, then he can't mistake this number for 9 and so on).

NoteThe first sample corresponds to perspective, depicted on the picture. Vasya sees numbers a2 (on the top face that is the darkest), a6 (on the right face that is the lightest) and a4 (on the left visible face).In the second sample Vasya can only see number a4.

The fist input line contains three space-separated integers x, y and z (|x|, |y|, |z| ≤ 106) — the coordinates of Vasya's position in space. The second line contains three space-separated integers x1, y1, z1 (1 ≤ x1, y1, z1 ≤ 106) — the coordinates of the box's vertex that is opposite to the vertex at point (0, 0, 0). The third line contains six space-separated integers a1, a2, ..., a6 (1 ≤ ai ≤ 106) — the numbers that are written on the box faces.  It is guaranteed that point (x, y, z) is located strictly outside the box.

Print a single integer — the sum of all numbers on the box faces that Vasya sees.

Input:
2 2 2
1 1 1
1 2 3 4 5 6

Output: 12

Input:
0 0 10
3 2 3
1 2 3 4 5 6

Output: 4

Input:
0 1 2
1 1 1
634728 627299 454463 927148 298618 186257

Output: 927148

Input:
5 2 -4
1 1 1
279519 704273 181008 670653 198973 996401

Output: 1881682

Input:
5 5 0
3 1 3
832224 636838 995053 211585 505442 341920

Output: 978758

Input:
-1 -9 14
9 8 10
172575 215800 344296 98651 566390 47011

Output: 837616

Input:
95892 79497 69936
7 4 6
873850 132840 469930 271591 257864 626722

Output: 1031153

Input:
-263980 -876063 613611
2 3 14
63640 300066 460766 222639 51956 412622

Output: 338235

Input:
30 68 72
51 54 95
480054 561470 308678 472768 90393 992511

Output: 561470

Input:
19 60 75
11 64 92
768641 208726 47379 514231 858941 959876

Output: 959876

Input:
37 96 41
27 74 97
747624 148752 730329 406930 814825 993124

Output: 1141876

Input:
573 79 619
36 69 96
955743 245262 675667 699027 275227 783730

Output: 1728019

Input:
34271 -17508 -6147
456 567 112
804178 307516 306399 18981 989216 228388

Output: 1338965

Input:
-33064 176437 217190
181 507 575
161371 827160 733690 99808 584032 954632

Output: 1511000

Input:
967 -1346 2551
769 331 28
458319 885170 877010 533360 723416 248230

Output: 1239909

Input:
46643 53735 -19637
3268 9109 5377
679826 208720 919306 797520 856404 373419

Output: 1501445

Input:
7412 -524 9621
8748 8870 1521
1043 894084 881852 56954 415764 946495

Output: 57997

Input:
409501 -349039 -285847
4386 1034 7566
166804 981888 780353 956617 563457 238748

Output: 1185905

Input:
7669 1619 6208
2230 2327 8551
28791 762474 463311 687868 175185 383245

Output: 383245

Input:
2581 12373 -1381
2048 8481 7397
118694 862180 426553 229109 698247 387794

Output: 1676527

Input:
35273 82177 67365
69755 14857 39718
925457 138136 454985 609590 83655 611361

Output: 747726

Input:
58224 94433 40185
55683 99614 33295
137430 61976 671256 929825 499631 90071

Output: 1019896

Input:
-267768 -542892 844309
53169 60121 20730
760938 814929 213048 452483 867280 110687

Output: 2080701

Input:
441810 183747 823363
945702 484093 693802
149570 186362 344439 753794 467269 643649

Output: 753794

Input:
298742 556311 628232
360973 607625 301540
278905 531131 923271 701344 873950 969819

Output: 701344

Input:
366317 904079 468911
819427 99580 451147
291702 801137 380674 646951 890909 998554

Output: 1448088

Input:
722477 814197 501318
670293 164127 180084
665889 389403 663253 449990 909406 240043

Output: 1079436

Input:
701521 392984 524392
462491 968267 126043
328074 993331 895443 352976 984911 318865

Output: 671841

Input:
-827584 -680412 -103147
897186 313672 388429
892050 717946 505625 200144 311983 606037

Output: 1709658

Input:
381718 587052 14730
290055 960762 231879
646112 249417 451908 49140 819134 575870

Output: 575870

Input:
4 4 4
6 3 3
1 2 3 4 5 6

Output: 6

Input:
8 4 4
10 3 3
1 2 3 4 5 6

Output: 6

Input:
3 10 3
6 6 6
2 4 8 16 32 64

Output: 4

Input:
1 3 1
2 2 2
1 2 4 8 16 32

Output: 2

Input:
1 1 3
2 2 2
1 2 3 4 5 6

Output: 4


Let's consider equation:x2 + s(x)·x - n = 0,  where x, n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.You are given an integer n, find the smallest positive integer root of equation x, or else determine that there are no such roots.

NoteIn the first test case x = 1 is the minimum root. As s(1) = 1 and 12 + 1·1 - 2 = 0.In the second test case x = 10 is the minimum root. As s(10) = 1 + 0 = 1 and 102 + 1·10 - 110 = 0.In the third test case the equation has no roots.

A single line contains integer n (1 ≤ n ≤ 1018) — the equation parameter. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier.

Print -1, if the equation doesn't have integer positive roots. Otherwise print such smallest integer x (x > 0), that the equation given in the statement holds.


Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.But I also don't want to use many numbers, so I'll choose three positive integers (they don't have to be distinct) which are not greater than n. Can you help me to find the maximum possible least common multiple of these three integers?

NoteThe least common multiple of some positive integers is the least positive integer which is multiple for each of them.The result may become very large, 32-bit integer won't be enough. So using 64-bit integers is recommended.For the last example, we can chose numbers 7, 6, 5 and the LCM of them is 7·6·5 = 210. It is the maximum value we can get.

The first line contains an integer n (1 ≤ n ≤ 106) — the n mentioned in the statement.

Print a single integer — the maximum possible LCM of three not necessarily distinct positive integers that are not greater than n.


Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:Find the sum modulo 1073741824 (230).

The first line contains three space-separated integers a, b and c (1 ≤ a, b, c ≤ 2000).

Print a single integer — the required sum modulo 1073741824 (230).

Input: 2 2 2

Output: 20

Input: 5 6 7

Output: 1520

Input: 91 42 25

Output: 3076687

Input: 38 47 5

Output: 160665

Input: 82 29 45

Output: 3504808

Input: 40 15 33

Output: 460153

Input: 35 5 21

Output: 55282

Input: 71 2 1

Output: 811

Input: 22 44 41

Output: 1063829

Input: 73 19 29

Output: 1047494

Input: 76 12 17

Output: 330197

Input: 16 10 49

Output: 146199

Input: 59 99 33

Output: 7052988

Input: 17 34 25

Output: 306673

Input: 21 16 9

Output: 45449

Input: 31 51 29

Output: 1255099

Input: 26 41 17

Output: 402568

Input: 85 19 5

Output: 139747

Input: 36 61 45

Output: 3253358

Input: 76 58 25

Output: 3635209

Input: 71 48 13

Output: 1179722

Input: 29 34 53

Output: 1461871

Input: 72 16 41

Output: 1309118

Input: 8 21 21

Output: 54740

Input: 11 51 5

Output: 38092

Input: 70 38 49

Output: 4467821

Input: 13 31 33

Output: 274773

Input: 53 29 17

Output: 621991

Input: 56 18 53

Output: 1518698

Input: 55 45 45

Output: 3751761

Input: 58 35 29

Output: 1706344

Input: 67 2 24

Output: 45108

Input: 62 96 8

Output: 1257040

Input: 21 22 100

Output: 1274891

Input: 64 12 36

Output: 687986

Input: 4 9 20

Output: 7302

Input: 7 99 4

Output: 36791

Input: 58 25 96

Output: 4812548

Input: 9 19 32

Output: 91192

Input: 45 16 12

Output: 167557

Input: 40 6 100

Output: 558275

Input: 46 93 44

Output: 6945002

Input: 49 31 28

Output: 1158568

Input: 89 28 8

Output: 441176

Input: 84 17 96

Output: 4615400

Input: 91 96 36

Output: 12931148

Input: 86 90 24

Output: 6779764

Input: 4 21 45

Output: 58045

Input: 100 7 28

Output: 429933

Input: 58 41 21

Output: 1405507

Input: 53 31 5

Output: 144839

Input: 41 28 36

Output: 1135934

Input: 44 18 24

Output: 436880

Input: 3 96 16

Output: 70613

Input: 98 34 100

Output: 13589991

Input: 82 31 32

Output: 2502213

Input: 85 25 20

Output: 1142825

Input: 35 12 8

Output: 50977

Input: 39 94 48

Output: 6368273

Input: 27 99 28

Output: 2276216

Input: 22 28 16

Output: 198639

Input: 80 15 4

Output: 76139

Input: 23 9 44

Output: 170773

Input: 33 16 36

Output: 441858

Input: 36 6 24

Output: 88626

Input: 98 92 12

Output: 3475151

Input: 90 82 100

Output: 35482866

Input: 77 79 31

Output: 6870344

Input: 81 21 19

Output: 812886

Input: 31 96 7

Output: 458123

Input: 34 89 95

Output: 11308813

Input: 18 86 27

Output: 1116623

Input: 13 76 11

Output: 206844

Input: 76 3 3

Output: 6118

Input: 15 93 87

Output: 4007595

Input: 63 90 23

Output: 4384553

Input: 58 83 7

Output: 819473

Input: 16 18 99

Output: 702678

Input: 60 8 35

Output: 363723

Input: 22 87 4

Output: 133986

Input: 73 25 44

Output: 2478308

Input: 36 3 32

Output: 50842

Input: 27 93 20

Output: 1393947

Input: 67 90 100

Output: 27880104

Input: 18 84 36

Output: 1564297

Input: 68 14 28

Output: 646819

Input: 71 8 12

Output: 119311

Input: 7 5 96

Output: 46328

Input: 50 95 32

Output: 5324602

Input: 13 22 24

Output: 124510

Input: 4 12 8

Output: 3347

Input: 100 9 88

Output: 2334910

Input: 95 2 28

Output: 82723

Input: 54 77 20

Output: 2573855

Input: 49 19 4

Output: 55037

Input: 58 86 99

Output: 21920084

Input: 9 76 83

Output: 1554836

Input: 64 2 27

Output: 49141

Input: 63 96 11

Output: 1898531

Input: 3 93 91

Output: 555583

Input: 100 100 100

Output: 51103588

Input: 1 5 1

Output: 10

Input: 4 4 4

Output: 328

Input: 10 10 10

Output: 11536

Input: 1091 742 925

Output: 611446273

Input: 138 247 605

Output: 617468110

Input: 1382 1729 1245

Output: 79895110

Input: 1140 1315 733

Output: 1055981852

Input: 735 605 1021

Output: 180258633

Input: 1271 302 701

Output: 748506344

Input: 322 1944 1341

Output: 82892316

Input: 273 1019 829

Output: 1017704869

Input: 1676 1012 1117

Output: 407213319

Input: 916 710 1149

Output: 155381249

Input: 159 1999 733

Output: 719397361

Input: 1917 1234 925

Output: 969972307

Input: 1321 716 509

Output: 779825241

Input: 1131 1651 829

Output: 191695865

Input: 726 941 1117

Output: 452231711

Input: 485 719 605

Output: 775023402

Input: 1536 361 1245

Output: 292799205

Input: 776 58 925

Output: 426546310

Input: 371 1348 1213

Output: 616855705

Input: 129 934 1053

Output: 417684564

Input: 1372 416 1341

Output: 255961610

Input: 1908 1921 1021

Output: 1053840771

Input: 1311 1051 605

Output: 556893941

Input: 1070 638 1149

Output: 451187539

Input: 313 631 733

Output: 824059168

Input: 1553 329 1117

Output: 473309078

Input: 956 1618 1053

Output: 1047062701

Input: 555 1045 1245

Output: 554328271

Input: 1958 335 829

Output: 637583302

Input: 867 602 924

Output: 57533516

Input: 462 596 508

Output: 296663254

Input: 221 22 700

Output: 197220843

Input: 1464 1312 636

Output: 387651199

Input: 704 1009 1020

Output: 64364024

Input: 107 299 604

Output: 480541628

Input: 58 1725 796

Output: 49225490

Input: 1109 1719 732

Output: 169550128

Input: 1645 1416 412

Output: 160380676

Input: 1240 706 700

Output: 101669803

Input: 646 293 1244

Output: 535895592

Input: 49 1231 828

Output: 117517540

Input: 1289 928 508

Output: 197608755

Input: 884 217 796

Output: 629300618

Input: 291 1996 636

Output: 316473739

Input: 1886 1990 924

Output: 482545854

Input: 1504 221 1245

Output: 1003302509

Input: 1100 407 828

Output: 1042476242

Input: 858 1641 1021

Output: 1011842644

Input: 453 931 605

Output: 187654596

Input: 1341 628 636

Output: 185202433

Input: 744 1918 924

Output: 271037737

Input: 503 1696 1116

Output: 321403975

Input: 98 634 700

Output: 701027535

Input: 282 331 732

Output: 290894585

Input: 1685 325 1020

Output: 1002767796

Input: 1635 1912 508

Output: 65307347

Input: 1039 1394 1148

Output: 574911571

Input: 1927 899 828

Output: 175550296

Input: 1522 28 1116

Output: 811777379

Input: 1280 1615 604

Output: 401478217

Input: 523 1609 1244

Output: 493458980

Input: 1433 1716 636

Output: 169806961

Input: 836 1006 924

Output: 685979813

Input: 1298 592 412

Output: 907284245

Input: 190 1882 700

Output: 76980183

Input: 1077 1579 731

Output: 655717753

Input: 481 1221 1019

Output: 912349591

Input: 431 296 507

Output: 965422678

Input: 1834 289 795

Output: 211098738

Input: 18 1986 827

Output: 106716470

Input: 1613 1276 411

Output: 799034342

Input: 76 703 603

Output: 614248875

Input: 615 1993 187

Output: 419411554

Input: 1663 1690 923

Output: 624566844

Input: 1258 1683 507

Output: 650634784

Input: 1016 918 699

Output: 642354242

Input: 260 208 635

Output: 906592721

Input: 422 1687 604

Output: 609700990

Input: 1473 625 1244

Output: 796043901

Input: 1936 403 732

Output: 664351950

Input: 827 1693 1020

Output: 287515428

Input: 67 1390 700

Output: 704292759

Input: 1118 1384 636

Output: 562267645

Input: 1068 1914 828

Output: 981592288

Input: 471 1908 412

Output: 569283586

Input: 1007 1605 796

Output: 422792697

Input: 250 895 732

Output: 979742940

Input: 713 322 924

Output: 828216144

Input: 1604 1612 508

Output: 856397819

Input: 300 1309 188

Output: 813647398

Input: 1895 1302 828

Output: 289288609

Input: 1654 377 1020

Output: 805695409

Input: 1249 19 604

Output: 987399471

Input: 158 286 699

Output: 607956938

Input: 1209 1576 283

Output: 908728109

Input: 1864 1002 827

Output: 578321039

Input: 563 996 411

Output: 84049653

Input: 1803 693 91

Output: 851948694

Input: 2000 2000 2000

Output: 281684196


Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that they talked very often and eventually they became a couple in the network. But yesterday, he came to see "her" in the real world and found out "she" is actually a very strong man! Our hero is very sad and he is too tired to love again now. So he came up with a way to recognize users' genders by their user names.This is his method: if the number of distinct characters in one's user name is odd, then he is a male, otherwise she is a female. You are given the string that denotes the user name, please help our hero to determine the gender of this user by his method.

CHAT WITH HER!
IGNORE HIM!
CHAT WITH HER!

NoteFor the first example. There are 6 distinct characters in "wjmzbmr". These characters are: "w", "j", "m", "z", "b", "r". So wjmzbmr is a female and you should print "CHAT WITH HER!".

The first line contains a non-empty string, that contains only lowercase English letters — the user name. This string contains at most 100 letters.

If it is a female by our hero's method, print "CHAT WITH HER!" (without the quotes), otherwise, print "IGNORE HIM!" (without the quotes).

Input: wjmzbmr

Output: CHAT WITH HER!

Input: xiaodao

Output: IGNORE HIM!

Input: sevenkplus

Output: CHAT WITH HER!

Input: pezu

Output: CHAT WITH HER!

Input: wnemlgppy

Output: CHAT WITH HER!

Input: zcinitufxoldnokacdvtmdohsfdjepyfioyvclhmujiqwvmudbfjzxjfqqxjmoiyxrfsbvseawwoyynn

Output: IGNORE HIM!

Input: qsxxuoynwtebujwpxwpajitiwxaxwgbcylxneqiebzfphugwkftpaikixmumkhfbjiswmvzbtiyifbx

Output: CHAT WITH HER!

Input: qwbdfzfylckctudyjlyrtmvbidfatdoqfmrfshsqqmhzohhsczscvwzpwyoyswhktjlykumhvaounpzwpxcspxwlgt

Output: IGNORE HIM!

Input: nuezoadauueermoeaabjrkxttkatspjsjegjcjcdmcxgodowzbwuqncfbeqlhkk

Output: IGNORE HIM!

Input: lggvdmulrsvtuagoavstuyufhypdxfomjlzpnduulukszqnnwfvxbvxyzmleocmofwclmzz

Output: IGNORE HIM!

Input: tgcdptnkc

Output: IGNORE HIM!

Input: wvfgnfrzabgibzxhzsojskmnlmrokydjoexnvi

Output: IGNORE HIM!

Input: sxtburpzskucowowebgrbovhadrrayamuwypmmxhscrujkmcgvyinp

Output: IGNORE HIM!

Input: pjqxhvxkyeqqvyuujxhmbspatvrckhhkfloottuybjivkkhpyivcighxumavrxzxslfpggnwbtalmhysyfllznphzia

Output: IGNORE HIM!

Input: fpellxwskyekoyvrfnuf

Output: CHAT WITH HER!

Input: xninyvkuvakfbs

Output: IGNORE HIM!

Input: vnxhrweyvhqufpfywdwftoyrfgrhxuamqhblkvdpxmgvphcbeeqbqssresjifwyzgfhurmamhkwupymuomak

Output: CHAT WITH HER!

Input: kmsk

Output: IGNORE HIM!

Input: lqonogasrkzhryjxppjyriyfxmdfubieglthyswz

Output: CHAT WITH HER!

Input: ndormkufcrkxlihdhmcehzoimcfhqsmombnfjrlcalffq

Output: CHAT WITH HER!

Input: zqzlnnuwcfufwujygtczfakhcpqbtxtejrbgoodychepzdphdahtxyfpmlrycyicqthsgm

Output: IGNORE HIM!

Input: ppcpbnhwoizajrl

Output: IGNORE HIM!

Input: sgubujztzwkzvztitssxxxwzanfmddfqvv

Output: CHAT WITH HER!

Input: ptkyaxycecpbrjnvxcjtbqiocqcswnmicxbvhdsptbxyxswbw

Output: IGNORE HIM!

Input: yhbtzfppwcycxqjpqdfmjnhwaogyuaxamwxpnrdrnqsgdyfvxu

Output: CHAT WITH HER!

Input: ojjvpnkrxibyevxk

Output: CHAT WITH HER!

Input: wjweqcrqfuollfvfbiyriijovweg

Output: IGNORE HIM!

Input: hkdbykboclchfdsuovvpknwqr

Output: IGNORE HIM!

Input: stjvyfrfowopwfjdveduedqylerqugykyu

Output: IGNORE HIM!

Input: rafcaanqytfclvfdegak

Output: CHAT WITH HER!

Input: xczn

Output: CHAT WITH HER!

Input: arcoaeozyeawbveoxpmafxxzdjldsielp

Output: IGNORE HIM!

Input: smdfafbyehdylhaleevhoggiurdgeleaxkeqdixyfztkuqsculgslheqfafxyghyuibdgiuwrdxfcitojxika

Output: CHAT WITH HER!

Input: vbpfgjqnhfazmvtkpjrdasfhsuxnpiepxfrzvoh

Output: CHAT WITH HER!

Input: dbdokywnpqnotfrhdbrzmuyoxfdtrgrzcccninbtmoqvxfatcqg

Output: CHAT WITH HER!

Input: udlpagtpq

Output: CHAT WITH HER!

Input: zjurevbytijifnpfuyswfchdzelxheboruwjqijxcucylysmwtiqsqqhktexcynquvcwhbjsipy

Output: CHAT WITH HER!

Input: qagzrqjomdwhagkhrjahhxkieijyten

Output: CHAT WITH HER!

Input: achhcfjnnfwgoufxamcqrsontgjjhgyfzuhklkmiwybnrlsvblnsrjqdytglipxsulpnphpjpoewvlusalsgovwnsngb

Output: CHAT WITH HER!

Input: qbkjsdwpahdbbohggbclfcufqelnojoehsxxkr

Output: CHAT WITH HER!

Input: cpvftiwgyvnlmbkadiafddpgfpvhqqvuehkypqjsoibpiudfvpkhzlfrykc

Output: IGNORE HIM!

Input: lnpdosnceumubvk

Output: IGNORE HIM!

Input: efrk

Output: CHAT WITH HER!

Input: temnownneghnrujforif

Output: IGNORE HIM!

Input: ottnneymszwbumgobazfjyxewkjakglbfflsajuzescplpcxqta

Output: IGNORE HIM!

Input: eswpaclodzcwhgixhpyzvhdwsgneqidanbzdzszquefh

Output: IGNORE HIM!

Input: gwntwbpj

Output: IGNORE HIM!

Input: wuqvlbblkddeindiiswsinkfrnkxghhwunzmmvyovpqapdfbolyim

Output: IGNORE HIM!

Input: swdqsnzmzmsyvktukaoyqsqzgfmbzhezbfaqeywgwizrwjyzquaahucjchegknqaioliqd

Output: CHAT WITH HER!

Input: vlhrpzezawyolhbmvxbwhtjustdbqggexmzxyieihjlelvwjosmkwesfjmramsikhkupzvfgezmrqzudjcalpjacmhykhgfhrjx

Output: IGNORE HIM!

Input: lxxwbkrjgnqjwsnflfnsdyxihmlspgivirazsbveztnkuzpaxtygidniflyjheejelnjyjvgkgvdqks

Output: CHAT WITH HER!

Input: wpxbxzfhtdecetpljcrvpjjnllosdqirnkzesiqeukbedkayqx

Output: CHAT WITH HER!

Input: vmzxgacicvweclaodrunmjnfwtimceetsaoickarqyrkdghcmyjgmtgsqastcktyrjgvjqimdc

Output: CHAT WITH HER!

Input: yzlzmesxdttfcztooypjztlgxwcr

Output: IGNORE HIM!

Input: qpbjwzwgdzmeluheirjrvzrhbmagfsjdgvzgwumjtjzecsfkrfqjasssrhhtgdqqfydlmrktlgfc

Output: IGNORE HIM!

Input: aqzftsvezdgouyrirsxpbuvdjupnzvbhguyayeqozfzymfnepvwgblqzvmxxkxcilmsjvcgyqykpoaktjvsxbygfgsalbjoq

Output: CHAT WITH HER!

Input: znicjjgijhrbdlnwmtjgtdgziollrfxroabfhadygnomodaembllreorlyhnehijfyjbfxucazellblegyfrzuraogadj

Output: IGNORE HIM!

Input: qordzrdiknsympdrkgapjxokbldorpnmnpucmwakklmqenpmkom

Output: CHAT WITH HER!

Input: wqfldgihuxfktzanyycluzhtewmwvnawqlfoavuguhygqrrxtstxwouuzzsryjqtfqo

Output: CHAT WITH HER!

Input: vujtrrpshinkskgyknlcfckmqdrwtklkzlyipmetjvaqxdsslkskschbalmdhzsdrrjmxdltbtnxbh

Output: IGNORE HIM!

Input: zioixjibuhrzyrbzqcdjbbhhdmpgmqykixcxoqupggaqajuzonrpzihbsogjfsrrypbiphehonyhohsbybnnukqebopppa

Output: CHAT WITH HER!

Input: oh

Output: CHAT WITH HER!

Input: kxqthadqesbpgpsvpbcbznxpecqrzjoilpauttzlnxvaczcqwuri

Output: IGNORE HIM!

Input: zwlunigqnhrwirkvufqwrnwcnkqqonebrwzcshcbqqwkjxhymjjeakuzjettebciadjlkbfp

Output: CHAT WITH HER!

Input: fjuldpuejgmggvvigkwdyzytfxzwdlofrpifqpdnhfyroginqaufwgjcbgshyyruwhofctsdaisqpjxqjmtpp

Output: CHAT WITH HER!

Input: xiwntnheuitbtqxrmzvxmieldudakogealwrpygbxsbluhsqhtwmdlpjwzyafckrqrdduonkgo

Output: CHAT WITH HER!

Input: mnmbupgo

Output: IGNORE HIM!

Input: mcjehdiygkbmrbfjqwpwxidbdfelifwhstaxdapigbymmsgrhnzsdjhsqchl

Output: IGNORE HIM!

Input: yocxrzspinchmhtmqo

Output: CHAT WITH HER!

Input: vasvvnpymtgjirnzuynluluvmgpquskuaafwogeztfnvybblajvuuvfomtifeuzpikjrolzeeoftv

Output: CHAT WITH HER!

Input: ecsdicrznvglwggrdbrvehwzaenzjutjydhvimtqegweurpxtjkmpcznshtrvotkvrghxhacjkedidqqzrduzad

Output: IGNORE HIM!

Input: ubvhyaebyxoghakajqrpqpctwbrfqzli

Output: CHAT WITH HER!

Input: gogbxfeqylxoummvgxpkoqzsmobasesxbqjjktqbwqxeiaagnnhbvepbpy

Output: IGNORE HIM!

Input: nheihhxkbbrmlpxpxbhnpofcjmxemyvqqdbanwd

Output: IGNORE HIM!

Input: acrzbavz

Output: CHAT WITH HER!

Input: drvzznznvrzskftnrhvvzxcalwutxmdza

Output: IGNORE HIM!

Input: oacwxipdfcoabhkwxqdbtowiekpnflnqhlrkustgzryvws

Output: CHAT WITH HER!

Input: tpnwfmfsibnccvdwjvzviyvjfljupinfigfunyff

Output: CHAT WITH HER!

Input: gavaihhamfolcndgytcsgucqdqngxkrlovpthvteacmmthoglxu

Output: CHAT WITH HER!

Input: hsfcfvameeupldgvchmogrvwxrvsmnwxxkxoawwodtsahqvehlcw

Output: IGNORE HIM!

Input: sbkydrscoojychxchqsuciperfroumenelgiyiwlqfwximrgdbyvkmacy

Output: CHAT WITH HER!

Input: rhh

Output: CHAT WITH HER!

Input: zhdouqfmlkenjzdijxdfxnlegxeuvhelo

Output: IGNORE HIM!

Input: yufkkfwyhhvcjntsgsvpzbhqtmtgyxifqoewmuplphykmptfdebjxuaxigomjtwgtljwdjhjernkitifbomifbhysnmadtnyn

Output: CHAT WITH HER!

Input: urigreuzpxnej

Output: CHAT WITH HER!


You've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has exactly two distinct positive integer divisors.Consider positive integers a, a + 1, ..., b (a ≤ b). You want to find the minimum integer l (1 ≤ l ≤ b - a + 1) such that for any integer x (a ≤ x ≤ b - l + 1) among l integers x, x + 1, ..., x + l - 1 there are at least k prime numbers. Find and print the required minimum l. If no value l meets the described limitations, print -1.

A single line contains three space-separated integers a, b, k (1 ≤ a, b, k ≤ 106; a ≤ b).

In a single line print a single integer — the required minimum l. If there's no solution, print -1.

Input: 2 4 2

Output: 3

Input: 6 13 1

Output: 4

Input: 1 4 3

Output: -1

Input: 5 8 2

Output: 4

Input: 8 10 3

Output: -1

Input: 1 5 2

Output: 3

Input: 6 8 3

Output: -1

Input: 21 29 2

Output: 9

Input: 17 27 3

Output: 11

Input: 1 1000000 10000

Output: 137970

Input: 690059 708971 10000

Output: -1

Input: 12357 534133 2

Output: 138

Input: 838069 936843 3

Output: 142

Input: 339554 696485 4

Output: 168

Input: 225912 522197 5

Output: 190

Input: 404430 864261 6

Output: 236

Input: 689973 807140 7

Output: 236

Input: 177146 548389 8

Output: 240

Input: 579857 857749 9

Output: 300

Input: 35648 527231 10

Output: 280

Input: 2 1000000 10000

Output: 137970

Input: 1 999999 9999

Output: 137958

Input: 5 5 10

Output: -1

Input: 11 11 6

Output: -1

Input: 4 4 95

Output: -1

Input: 1 1000000 1000000

Output: -1

Input: 1 1000000 78498

Output: 999999

Input: 1 1000000 78499

Output: -1

Input: 3459 94738 1

Output: 72

Input: 1 1000000 1

Output: 114

Input: 1 1000000 78497

Output: 999998

Input: 1 1000000 78490

Output: 999978

Input: 1000 10000 13

Output: 168

Input: 100000 1000000 7821

Output: 108426

Input: 20 1000000 40000

Output: 539580

Input: 1000 900000 50000

Output: 659334

Input: 10000 1000000 60000

Output: 793662

Input: 9999 99999 8000

Output: 86572

Input: 50 150 20

Output: 100

Input: 999953 999953 1

Output: 1

Input: 999953 999953 2

Output: -1

Input: 999931 999953 2

Output: 23

Input: 999906 999984 4

Output: 52

Input: 999940 999983 3

Output: 26

Input: 1 1 1

Output: -1

Input: 1 1 1000000

Output: -1

Input: 1 2 1

Output: 2

Input: 1 3 1

Output: 2

Input: 1 3 2

Output: 3

Input: 1 4 2

Output: 3

Input: 1 5 3

Output: 5

Input: 2 5 2

Output: 3

Input: 3 5 1

Output: 2


A sequence of non-negative integers a1, a2, ..., an of length n is called a wool sequence if and only if there exists two integers l and r (1 ≤ l ≤ r ≤ n) such that . In other words each wool sequence contains a subsequence of consecutive elements with xor equal to 0.The expression  means applying the operation of a bitwise xor to numbers x and y. The given operation exists in all modern programming languages, for example, in languages C++ and Java it is marked as "^", in Pascal — as "xor".In this problem you are asked to compute the number of sequences made of n integers from 0 to 2m - 1 that are not a wool sequence. You should print this number modulo 1000000009 (109 + 9).

NoteSequences of length 3 made of integers 0, 1, 2 and 3 that are not a wool sequence are (1, 3, 1), (1, 2, 1), (2, 1, 2), (2, 3, 2), (3, 1, 3) and (3, 2, 3).

The only line of input contains two space-separated integers n and m (1 ≤ n, m ≤ 105).

Print the required number of sequences modulo 1000000009 (109 + 9) on the only line of output.

Input: 3 2

Output: 6

Input: 4 2

Output: 0

Input: 1 2

Output: 3

Input: 4 11

Output: 433239206

Input: 5 100

Output: 345449482

Input: 5444 31525

Output: 637906839

Input: 60282 92611

Output: 814908070

Input: 62600 39199

Output: 366778414

Input: 14095 86011

Output: 656508583

Input: 78606 36436

Output: 657976765

Input: 25063 54317

Output: 735545216

Input: 86232 41348

Output: 77566161

Input: 94882 95834

Output: 360122315

Input: 83781 52238

Output: 188770162

Input: 21857 94145

Output: 689996210

Input: 7413 87155

Output: 340839315

Input: 7683 65667

Output: 298588855

Input: 88201 96978

Output: 508134449

Input: 50664 46559

Output: 425318276

Input: 60607 63595

Output: 396334239

Input: 85264 15318

Output: 635855261

Input: 100000 100000

Output: 738698541

Input: 100000 16

Output: 0

Input: 100000 17

Output: 614965071

Input: 127 7

Output: 399589559

Input: 128 8

Output: 987517349

Input: 65535 16

Output: 558444716

Input: 99999 1

Output: 0

Input: 1 99999

Output: 833014736

Input: 1 29

Output: 536870911

Input: 2 15

Output: 73643513

Input: 1 1

Output: 1

Input: 2 1

Output: 0

Input: 2 2

Output: 6

Input: 3 1

Output: 0

Input: 3 2

Output: 6

Input: 3 3

Output: 210

Input: 4 1

Output: 0

Input: 4 2

Output: 0

Input: 4 3

Output: 840

Input: 4 4

Output: 32760

Input: 12345 31

Output: 378093434

Input: 50000 100000

Output: 821709120


Vasya is an active Internet user. One day he came across an Internet resource he liked, so he wrote its address in the notebook. We know that the address of the written resource has format: <protocol>://<domain>.ru[/<context>] where:  <protocol> can equal either "http" (without the quotes) or "ftp" (without the quotes),  <domain> is a non-empty string, consisting of lowercase English letters,  the /<context> part may not be present. If it is present, then <context> is a non-empty string, consisting of lowercase English letters. If string <context> isn't present in the address, then the additional character "/" isn't written. Thus, the address has either two characters "/" (the ones that go before the domain), or three (an extra one in front of the context).When the boy came home, he found out that the address he wrote in his notebook had no punctuation marks. Vasya must have been in a lot of hurry and didn't write characters ":", "/", ".".Help Vasya to restore the possible address of the recorded Internet resource.

NoteIn the second sample there are two more possible answers: "ftp://httpruru.ru" and "ftp://httpru.ru/ru".

The first line contains a non-empty string that Vasya wrote out in his notebook. This line consists of lowercase English letters only.  It is guaranteed that the given string contains at most 50 letters. It is guaranteed that the given string can be obtained from some correct Internet resource address, described above.

Print a single line — the address of the Internet resource that Vasya liked. If there are several addresses that meet the problem limitations, you are allowed to print any of them.

Input: httpsunrux

Input: ftphttprururu

Input: httpuururrururruruurururrrrrurrurrurruruuruuu

Input: httpabuaruauabbaruru

Input: httpuurrruurruuruuruuurrrurururuurruuuuuuruurr

Input: httpruhhphhhpuhruruhhpruhhphruhhru

Input: httpftprftprutprururftruruftptp

Input: httpfttpftpfttftpftpftppfrurururu

Input: httpruhttttpruhttprupruhttpruhtturuhttphtruuru

Input: httpsjkazaaghasjkasjkabruru

Input: httpftphttptphttphrururuhpftphtpftphtpftphtptpft

Input: httpppppru

Input: ftprrurururrurururuurrururruuru

Input: ftpabaruru

Input: ftpruurruurururururuuruuur

Input: ftphhphruhhpruhhpuhhpuruhhphruhhruhhpuhhru

Input: ftparua

Input: httpzru

Input: httprrur

Input: ftprru


Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.Now he wonders what is an average value of sum of digits of the number A written in all bases from 2 to A - 1.Note that all computations should be done in base 10. You should find the result as an irreducible fraction, written in base 10.

NoteIn the first sample number 5 written in all bases from 2 to 4 looks so: 101, 12, 11. Sums of digits are 2, 3 and 2, respectively.

Input contains one integer number A (3 ≤ A ≤ 1000).

Output should contain required average value in format «X/Y», where X is the numerator and Y is the denominator.


Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a × a.What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Theatre Square, but the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square.

The input contains three positive integer numbers in the first line: n,  m and a (1 ≤  n, m, a ≤ 109).

Input: 6 6 4

Output: 4

Input: 1 1 1

Output: 1

Input: 2 1 1

Output: 2

Input: 1 2 1

Output: 2

Input: 2 2 1

Output: 4

Input: 2 1 2

Output: 1

Input: 1 1 3

Output: 1

Input: 2 3 4

Output: 1

Input: 1000000000 1000000000 1

Output: 1000000000000000000

Input: 12 13 4

Output: 12

Input: 222 332 5

Output: 3015

Input: 1000 1000 10

Output: 10000

Input: 1001 1000 10

Output: 10100

Input: 100 10001 1000000000

Output: 1

Input: 1000000000 1000000000 1000000000

Output: 1

Input: 1000000000 1000000000 999999999

Output: 4

Input: 1000000000 1000000000 192

Output: 27126743055556

Input: 1000000000 987654321 1

Output: 987654321000000000

Input: 456784567 1000000000 51

Output: 175618850864484

Input: 39916800 134217728 40320

Output: 3295710


Certainly, everyone is familiar with tic-tac-toe game. The rules are very simple indeed. Two players take turns marking the cells in a 3 × 3 grid (one player always draws crosses, the other — noughts). The player who succeeds first in placing three of his marks in a horizontal, vertical or diagonal line wins, and the game is finished. The player who draws crosses goes first. If the grid is filled, but neither Xs, nor 0s form the required line, a draw is announced.You are given a 3 × 3 grid, each grid cell is empty, or occupied by a cross or a nought. You have to find the player (first or second), whose turn is next, or print one of the verdicts below:   illegal — if the given board layout can't appear during a valid game;  the first player won — if in the given board layout the first player has just won;  the second player won — if in the given board layout the second player has just won;  draw — if the given board layout has just let to a draw.

The input consists of three lines, each of the lines contains characters ".", "X" or "0" (a period, a capital letter X, or a digit zero).

Print one of the six verdicts: first, second, illegal, the first player won, the second player won or draw.

Input:
X0X
.0.
.X.

Output: second

Input:
0.X
XX.
000

Output: illegal

Input:
XXX
.0.
000

Output: illegal

Input:
XXX
...
000

Output: illegal

Input:
X.X
X..
00.

Output: second

Input:
X.X
X.0
0.0

Output: first

Input:
0..
...
...

Output: illegal

Input:
XXX
X00
X00

Output: the first player won

Input:
000
X.X
X.X

Output: illegal

Input:
XXX
0.0
0..

Output: illegal

Input:
X0X
0X0
X0X

Output: the first player won

Input:
XX.
X0X
X..

Output: illegal

Input:
X0X
0X0
X..

Output: the first player won

Input:
XX0
0..
000

Output: illegal

Input:
XXX
0..
.0.

Output: the first player won

Input:
XXX
X..
.00

Output: illegal

Input:
X00
0.0
XX0

Output: illegal

Input:
0.0
0XX
..0

Output: illegal

Input:
.00
X.X
0..

Output: illegal

Input:
..0
.00
.0X

Output: illegal

Input:
..0
0..
00X

Output: illegal

Input:
..0
.XX
X..

Output: illegal

Input:
0.X
0X0
.00

Output: illegal

Input:
..X
0X0
0X.

Output: first

Input:
0X0
X..
X.0

Output: first

Input:
.0.
X.X
0..

Output: first

Input:
0X0
00X
.00

Output: illegal

Input:
.0.
.X0
X..

Output: first

Input:
00X
0.X
00X

Output: illegal

Input:
00X
0XX
0X.

Output: the second player won

Input:
X00
..0
X.X

Output: first

Input:
X00
X00
.X0

Output: illegal

Input:
X0X
.X0
0..

Output: first

Input:
..0
XXX
000

Output: illegal

Input:
XXX
...
.0.

Output: illegal

Input:
0..
000
X0X

Output: illegal

Input:
.00
0X.
0.0

Output: illegal

Input:
X..
X00
0.0

Output: illegal

Input:
.X0
XX0
X.X

Output: illegal

Input:
X.X
0.0
X..

Output: second

Input:
00X
.00
..0

Output: illegal

Input:
..0
0.X
00.

Output: illegal

Input:
0.X
X0X
.X0

Output: illegal

Input:
0X.
.X.
0X0

Output: illegal

Input:
00.
X0.
..X

Output: illegal

Input:
..X
.00
XX.

Output: second

Input:
.00
.0.
.X.

Output: illegal

Input:
XX0
X.0
XX0

Output: illegal

Input:
00.
00.
X.X

Output: illegal

Input:
X00
X.0
X.0

Output: illegal

Input:
0X.
0XX
000

Output: illegal

Input:
00.
00.
.X.

Output: illegal

Input:
X0X
00.
0.X

Output: illegal

Input:
XX0
XXX
0X0

Output: illegal

Input:
XX0
..X
XX0

Output: illegal

Input:
0X.
..X
X..

Output: illegal

Input:
...
X0.
XX0

Output: second

Input:
..X
.0.
0..

Output: illegal

Input:
00X
XX.
00X

Output: first

Input:
..0
XX0
..X

Output: second

Input:
.0.
.00
X00

Output: illegal

Input:
X00
.XX
00.

Output: illegal

Input:
.00
0.X
000

Output: illegal

Input:
X0.
..0
X.0

Output: illegal

Input:
X0X
.XX
00.

Output: second

Input:
0X.
00.
.X.

Output: illegal

Input:
0..
000
...

Output: illegal

Input:
.0.
...
0.0

Output: illegal

Input:
..X
X00
0.0

Output: illegal

Input:
0XX
...
X0.

Output: second

Input:
X.X
0X.
.0X

Output: illegal

Input:
XX0
X.X
00.

Output: second

Input:
.0X
.00
00.

Output: illegal

Input:
.XX
XXX
0..

Output: illegal

Input:
XX0
.X0
.0.

Output: first

Input:
X00
0.X
X..

Output: first

Input:
X..
.X0
X0.

Output: second

Input:
.0X
X..
XXX

Output: illegal

Input:
X0X
XXX
X.X

Output: illegal

Input:
.00
X0.
00X

Output: illegal

Input:
0XX
.X0
0.0

Output: illegal

Input:
00X
XXX
..0

Output: the first player won

Input:
X0X
...
.X.

Output: illegal

Input:
.X0
...
0X.

Output: first

Input:
X..
0X0
X.0

Output: first

Input:
..0
.00
X.0

Output: illegal

Input:
.XX
.0.
X0X

Output: illegal

Input:
00.
0XX
..0

Output: illegal

Input:
.0.
00.
00.

Output: illegal

Input:
00.
000
X.X

Output: illegal

Input:
0X0
.X0
.X.

Output: illegal

Input:
00X
0..
0..

Output: illegal

Input:
.X.
.X0
X.0

Output: second

Input:
.0.
0X0
X0X

Output: illegal

Input:
...
X.0
0..

Output: illegal

Input:
..0
XX.
00X

Output: first

Input:
0.X
.0X
X00

Output: illegal

Input:
..X
0X.
.0.

Output: first

Input:
..X
X.0
.0X

Output: second

Input:
X0.
.0X
X0X

Output: illegal

Input:
...
.0.
.X0

Output: illegal

Input:
.X0
XX0
0..

Output: first

Input:
0X.
...
X..

Output: second

Input:
.0.
0.0
0.X

Output: illegal

Input:
XX.
.X0
.0X

Output: illegal

Input:
.0.
X0X
X00

Output: illegal

Input:
0X.
.X0
X..

Output: second

Input:
..0
0X.
000

Output: illegal

Input:
0.0
X.X
XX.

Output: illegal

Input:
.X.
.XX
X0.

Output: illegal

Input:
X.X
.XX
0X.

Output: illegal

Input:
...
.X.
...

Output: second

Input:
..0
.X.
...

Output: first

Input:
..0
.XX
...

Output: second

Input:
..0
0XX
...

Output: first

Input:
X.0
0XX
...

Output: second

Input:
X.0
0XX
..0

Output: first

Input:
X.0
0XX
.X0

Output: second

Input:
X00
0XX
.X0

Output: first

Input:
X00
0XX
XX0

Output: draw

Input:
X00
0XX
0X0

Output: illegal

Input:
XXX
XXX
XXX

Output: illegal

Input:
000
000
000

Output: illegal

Input:
XX0
00X
XX0

Output: draw

Input:
X00
00X
XX0

Output: illegal

Input:
X.0
00.
XXX

Output: the first player won

Input:
X..
X0.
X0.

Output: the first player won

Input:
.XX
000
XX0

Output: the second player won

Input:
X0.
X.X
X00

Output: the first player won

Input:
00X
X00
XXX

Output: the first player won

Input:
XXX
.00
X0.

Output: the first player won

Input:
XX0
000
XX.

Output: the second player won

Input:
.X0
0.0
XXX

Output: the first player won

Input:
0XX
X00
0XX

Output: draw

Input:
0XX
X0X
00X

Output: the first player won

Input:
XX0
0XX
0X0

Output: the first player won

Input:
0X0
X0X
X0X

Output: draw

Input:
XXX
0.0
...

Output: the first player won

Input:
X0X
0XX
00X

Output: the first player won

Input:
0XX
X0.
X00

Output: the second player won

Input:
X.0
0X0
XX0

Output: the second player won

Input:
X0X
X0X
0X0

Output: draw

Input:
X.0
00X
0XX

Output: the second player won

Input:
00X
X0X
.X0

Output: the second player won

Input:
X0X
.00
X0X

Output: the second player won

Input:
0XX
X00
X0X

Output: draw

Input:
000
X0X
.XX

Output: the second player won

Input:
0.0
0.X
XXX

Output: the first player won

Input:
X.0
X0.
0X.

Output: the second player won

Input:
X0X
0X0
..X

Output: the first player won

Input:
0X0
XX0
.X.

Output: the first player won

Input:
X0.
.X.
0.X

Output: the first player won

Input:
0XX
X00
.X0

Output: the second player won

Input:
0.0
XXX
0.X

Output: the first player won

Input:
.0X
.X.
X.0

Output: the first player won

Input:
XXX
X.0
0.0

Output: the first player won

Input:
XX0
X..
X00

Output: the first player won

Input:
XXX
00X
00X

Output: the first player won

Input:
X00
00X
XXX

Output: the first player won

Input:
0X0
X0X
0X.

Output: the second player won

Input:
XX0
X00
0X.

Output: the second player won

Input:
..X
0X0
X..

Output: the first player won

Input:
X0.
00.
XXX

Output: the first player won

Input:
0.X
X00
XX0

Output: the second player won

Input:
X0.
0X.
..X

Output: the first player won

Input:
00X
X0.
XX0

Output: the second player won

Input:
XX.
000
0XX

Output: the second player won

Input:
..X
0.X
.0X

Output: the first player won

Input:
X00
.0X
0XX

Output: the second player won

Input:
00X
0X.
XX.

Output: the first player won

Input:
X00
XX.
0.X

Output: the first player won

Input:
XXX
00X
0X0

Output: the first player won

Input:
X00
XX0
0XX

Output: the first player won

Input:
0X0
X00
XXX

Output: the first player won

Input:
XX0
X00
.X0

Output: the second player won


Johnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother about the task that her kindergartener asked her to solve. The task was just to construct a triangle out of four sticks of different colours. Naturally, one of the sticks is extra. It is not allowed to break the sticks or use their partial length. Anne has perfectly solved this task, now she is asking Johnny to do the same.The boy answered that he would cope with it without any difficulty. However, after a while he found out that different tricky things can occur. It can happen that it is impossible to construct a triangle of a positive area, but it is possible to construct a degenerate triangle. It can be so, that it is impossible to construct a degenerate triangle even. As Johnny is very lazy, he does not want to consider such a big amount of cases, he asks you to help him.

The first line of the input contains four space-separated positive integer numbers not exceeding 100 — lengthes of the sticks.

Output TRIANGLE if it is possible to construct a non-degenerate triangle. Output SEGMENT if the first case cannot take place and it is possible to construct a degenerate triangle. Output IMPOSSIBLE if it is impossible to construct any triangle. Remember that you are to use three sticks. It is not allowed to break the sticks or use their partial length.

Input: 4 2 1 3

Output: TRIANGLE

Input: 7 2 2 4

Output: SEGMENT

Input: 3 5 9 1

Output: IMPOSSIBLE

Input: 3 1 5 1

Output: IMPOSSIBLE

Input: 10 10 10 10

Output: TRIANGLE

Input: 11 5 6 11

Output: TRIANGLE

Input: 1 1 1 1

Output: TRIANGLE

Input: 10 20 30 40

Output: TRIANGLE

Input: 45 25 5 15

Output: IMPOSSIBLE

Input: 20 5 8 13

Output: TRIANGLE

Input: 10 30 7 20

Output: SEGMENT

Input: 3 2 3 2

Output: TRIANGLE

Input: 70 10 100 30

Output: SEGMENT

Input: 4 8 16 2

Output: IMPOSSIBLE

Input: 3 3 3 10

Output: TRIANGLE

Input: 1 5 5 5

Output: TRIANGLE

Input: 13 25 12 1

Output: SEGMENT

Input: 10 100 7 3

Output: SEGMENT

Input: 50 1 50 100

Output: TRIANGLE

Input: 50 1 100 49

Output: SEGMENT

Input: 49 51 100 1

Output: SEGMENT

Input: 5 11 2 25

Output: IMPOSSIBLE

Input: 91 50 9 40

Output: IMPOSSIBLE

Input: 27 53 7 97

Output: IMPOSSIBLE

Input: 51 90 24 8

Output: IMPOSSIBLE

Input: 3 5 1 1

Output: IMPOSSIBLE

Input: 13 49 69 15

Output: IMPOSSIBLE

Input: 16 99 9 35

Output: IMPOSSIBLE

Input: 27 6 18 53

Output: IMPOSSIBLE

Input: 57 88 17 8

Output: IMPOSSIBLE

Input: 95 20 21 43

Output: IMPOSSIBLE

Input: 6 19 32 61

Output: IMPOSSIBLE

Input: 100 21 30 65

Output: IMPOSSIBLE

Input: 85 16 61 9

Output: IMPOSSIBLE

Input: 5 6 19 82

Output: IMPOSSIBLE

Input: 1 5 1 3

Output: IMPOSSIBLE

Input: 65 10 36 17

Output: IMPOSSIBLE

Input: 81 64 9 7

Output: IMPOSSIBLE

Input: 11 30 79 43

Output: IMPOSSIBLE

Input: 1 1 5 3

Output: IMPOSSIBLE

Input: 21 94 61 31

Output: IMPOSSIBLE

Input: 49 24 9 74

Output: IMPOSSIBLE

Input: 11 19 5 77

Output: IMPOSSIBLE

Input: 52 10 19 71

Output: SEGMENT

Input: 2 3 7 10

Output: SEGMENT

Input: 1 2 6 3

Output: SEGMENT

Input: 2 6 1 8

Output: SEGMENT

Input: 1 2 4 1

Output: SEGMENT

Input: 4 10 6 2

Output: SEGMENT

Input: 2 10 7 3

Output: SEGMENT

Input: 5 2 3 9

Output: SEGMENT

Input: 6 1 4 10

Output: SEGMENT

Input: 10 6 4 1

Output: SEGMENT

Input: 3 2 9 1

Output: SEGMENT

Input: 22 80 29 7

Output: SEGMENT

Input: 2 6 3 9

Output: SEGMENT

Input: 3 1 2 1

Output: SEGMENT

Input: 3 4 7 1

Output: SEGMENT

Input: 8 4 3 1

Output: SEGMENT

Input: 2 8 3 5

Output: SEGMENT

Input: 4 1 2 1

Output: SEGMENT

Input: 8 1 3 2

Output: SEGMENT

Input: 6 2 1 8

Output: SEGMENT

Input: 3 3 3 6

Output: TRIANGLE

Input: 3 6 3 3

Output: TRIANGLE

Input: 4 10 4 4

Output: TRIANGLE

Input: 1 1 2 1

Output: TRIANGLE

Input: 3 3 3 6

Output: TRIANGLE

Input: 5 4 5 5

Output: TRIANGLE

Input: 8 7 8 8

Output: TRIANGLE

Input: 3 3 3 1

Output: TRIANGLE

Input: 1 1 6 6

Output: TRIANGLE

Input: 1 9 1 9

Output: TRIANGLE

Input: 7 2 2 7

Output: TRIANGLE

Input: 7 2 3 2

Output: TRIANGLE

Input: 4 4 10 10

Output: TRIANGLE

Input: 7 7 10 7

Output: TRIANGLE

Input: 4 4 4 5

Output: TRIANGLE

Input: 1 10 9 2

Output: TRIANGLE

Input: 1 8 2 7

Output: TRIANGLE

Input: 4 3 2 8

Output: TRIANGLE

Input: 5 9 5 3

Output: TRIANGLE

Input: 4 10 3 5

Output: TRIANGLE


A famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have been playing this old game on uninteresting, monotonous boards. Kalevitch decided to put an end to this tradition and to introduce a new attitude to chessboards.As before, the chessboard is a square-checkered board with the squares arranged in a 8 × 8 grid, each square is painted black or white. Kalevitch suggests that chessboards should be painted in the following manner: there should be chosen a horizontal or a vertical line of 8 squares (i.e. a row or a column), and painted black. Initially the whole chessboard is white, and it can be painted in the above described way one or more times. It is allowed to paint a square many times, but after the first time it does not change its colour any more and remains black. Kalevitch paints chessboards neatly, and it is impossible to judge by an individual square if it was painted with a vertical or a horizontal stroke.Kalevitch hopes that such chessboards will gain popularity, and he will be commissioned to paint chessboards, which will help him ensure a comfortable old age. The clients will inform him what chessboard they want to have, and the painter will paint a white chessboard meeting the client's requirements.It goes without saying that in such business one should economize on everything — for each commission he wants to know the minimum amount of strokes that he has to paint to fulfill the client's needs. You are asked to help Kalevitch with this task.

WWWBWWBW
BBBBBBBB
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW

WWWWWWWW
BBBBBBBB
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW

The input file contains 8 lines, each of the lines contains 8 characters. The given matrix describes the client's requirements, W character stands for a white square, and B character — for a square painted black. It is guaranteed that client's requirments can be fulfilled with a sequence of allowed strokes (vertical/column or horizontal/row).

Output the only number — the minimum amount of rows and columns that Kalevitch has to paint on the white chessboard to meet the client's requirements.

Input:
WWWBWWBW
BBBBBBBB
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW

Output: 3

Input:
WWWWWWWW
BBBBBBBB
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW

Output: 1

Input:
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW

Output: 0

Input:
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB

Output: 8

Input:
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBW

Output: 14

Input:
BBBBBBBB
BBBBBBBB
BBBBBBWB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB

Output: 14

Input:
BBBBBBBB
WBBBWBBW
BBBBBBBB
WBBBWBBW
WBBBWBBW
BBBBBBBB
BBBBBBBB
WBBBWBBW

Output: 9

Input:
BBBBBBBB
WBBWWWBB
BBBBBBBB
WBBWWWBB
BBBBBBBB
BBBBBBBB
WBBWWWBB
BBBBBBBB

Output: 9

Input:
BBBBBWWB
BBBBBBBB
BBBBBBBB
BBBBBWWB
BBBBBWWB
BBBBBWWB
BBBBBWWB
BBBBBWWB

Output: 8

Input:
WWWWBBBB
WWWWBBBB
BBBBBBBB
BBBBBBBB
WWWWBBBB
WWWWBBBB
BBBBBBBB
BBBBBBBB

Output: 8

Input:
BBBBBBBB
WBWWBBBW
BBBBBBBB
WBWWBBBW
WBWWBBBW
WBWWBBBW
WBWWBBBW
BBBBBBBB

Output: 7

Input:
WBWWBBBW
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
WBWWBBBW
WBWWBBBW

Output: 9

Input:
BBWWBBBW
BBBBBBBB
BBBBBBBB
BBWWBBBW
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB

Output: 11

Input:
WWBWBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
WWBWBBBB
BBBBBBBB
WWBWBBBB
BBBBBBBB

Output: 10

Input:
BBBBBBBB
BBBBBBBB
BBBBBBBB
WWBWBBBB
WWBWBBBB
BBBBBBBB
BBBBBBBB
WWBWBBBB

Output: 10

Input:
WBBWBBBW
WBBWBBBW
WBBWBBBW
WBBWBBBW
WBBWBBBW
BBBBBBBB
WBBWBBBW
WBBWBBBW

Output: 6

Input:
BBBWBBBW
BBBWBBBW
BBBWBBBW
BBBBBBBB
BBBBBBBB
BBBWBBBW
BBBBBBBB
BBBBBBBB

Output: 10

Input:
BBBBBBBB
BBBWBBBB
BBBWBBBB
BBBWBBBB
BBBBBBBB
BBBWBBBB
BBBWBBBB
BBBWBBBB

Output: 9

Input:
BBBBBBBB
WWWBBBBB
WWWBBBBB
BBBBBBBB
WWWBBBBB
WWWBBBBB
BBBBBBBB
BBBBBBBB

Output: 9

Input:
WBBBBBWB
BBBBBBBB
WBBBBBWB
WBBBBBWB
WBBBBBWB
WBBBBBWB
WBBBBBWB
BBBBBBBB

Output: 8

Input:
WBBBWWBW
WBBBWWBW
BBBBBBBB
WBBBWWBW
BBBBBBBB
WBBBWWBW
WBBBWWBW
WBBBWWBW

Output: 6

Input:
WBBBBWBB
BBBBBBBB
BBBBBBBB
WBBBBWBB
WBBBBWBB
BBBBBBBB
WBBBBWBB
BBBBBBBB

Output: 10

Input:
BBBBBBBB
BBBBBBBB
BBBBBBBB
WBBBWBBW
BBBBBBBB
BBBBBBBB
WBBBWBBW
BBBBBBBB

Output: 11

Input:
BBBBBBBB
BWBBBBBW
BWBBBBBW
BBBBBBBB
BWBBBBBW
BWBBBBBW
BBBBBBBB
BWBBBBBW

Output: 9

Input:
BBBBBBBB
BBBBBBBB
WBBBWWWW
BBBBBBBB
BBBBBBBB
WBBBWWWW
BBBBBBBB
BBBBBBBB

Output: 9

Input:
BWBBBWWB
BWBBBWWB
BBBBBBBB
BBBBBBBB
BWBBBWWB
BBBBBBBB
BBBBBBBB
BBBBBBBB

Output: 10

Input:
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BBBBBBBB
BWBBWBWB

Output: 12

Input:
BWBBBBWW
BWBBBBWW
BWBBBBWW
BWBBBBWW
BBBBBBBB
BWBBBBWW
BWBBBBWW
BBBBBBBB

Output: 7

Input:
WWBBWWBB
BBBBBBBB
WWBBWWBB
WWBBWWBB
WWBBWWBB
BBBBBBBB
WWBBWWBB
WWBBWWBB

Output: 6

Input:
BWBBWWWW
BWBBWWWW
BWBBWWWW
BBBBBBBB
BBBBBBBB
BBBBBBBB
BWBBWWWW
BBBBBBBB

Output: 7


The whole world got obsessed with robots,and to keep pace with the progress, great Berland's programmer Draude decided to build his own robot. He was working hard at the robot. He taught it to walk the shortest path from one point to another, to record all its movements, but like in many Draude's programs, there was a bug — the robot didn't always walk the shortest path. Fortunately, the robot recorded its own movements correctly. Now Draude wants to find out when his robot functions wrong. Heh, if Draude only remembered the map of the field, where he tested the robot, he would easily say if the robot walked in the right direction or not. But the field map was lost never to be found, that's why he asks you to find out if there exist at least one map, where the path recorded by the robot is the shortest.The map is an infinite checkered field, where each square is either empty, or contains an obstruction. It is also known that the robot never tries to run into the obstruction. By the recorded robot's movements find out if there exist at least one such map, that it is possible to choose for the robot a starting square (the starting square should be empty) such that when the robot moves from this square its movements coincide with the recorded ones (the robot doesn't run into anything, moving along empty squares only), and the path from the starting square to the end one is the shortest.In one movement the robot can move into the square (providing there are no obstrutions in this square) that has common sides with the square the robot is currently in.

The first line of the input file contains the recording of the robot's movements. This recording is a non-empty string, consisting of uppercase Latin letters L, R, U and D, standing for movements left, right, up and down respectively. The length of the string does not exceed 100.

In the first line output the only word OK (if the above described map exists), or BUG (if such a map does not exist).

Input: LLUUUR

Output: OK

Input: RRUULLDD

Output: BUG

Input: L

Output: OK

Input: R

Output: OK

Input: RR

Output: OK

Input: DL

Output: OK

Input: LD

Output: OK

Input: RUL

Output: BUG

Input: ULD

Output: BUG

Input: DDR

Output: OK

Input: RRDD

Output: OK

Input: RRLR

Output: BUG

Input: RRDL

Output: BUG

Input: LRUD

Output: BUG

Input: RDRLL

Output: BUG

Input: DRDRD

Output: OK

Input: ULURL

Output: BUG

Input: LUUDU

Output: BUG

Input: RDLUR

Output: BUG

Input: DLDLDDRR

Output: OK

Input: RDRDDD

Output: OK

Input: UULLDLUR

Output: BUG

Input: LULU

Output: OK

Input: LLDDLDLLDDDLLLDLLLLLUU

Output: OK

Input: URRRRRURRURUURRRRRDDDDLDDDRDDDDLLDLL

Output: OK

Input: UL

Output: OK

Input: UDR

Output: BUG

Input: DDDR

Output: OK

Input: UUUDU

Output: BUG

Input: LULULL

Output: OK

Input: DLURUUU

Output: BUG

Input: UURUURRUUU

Output: OK

Input: DDDDRDDLDDDDDDDRDDLD

Output: OK

Input: URRRLULUURURLRLLLLULLRLRURLULRLULLULRRUU

Output: BUG

Input: RURRRRLURRRURRUURRRRRRRRDDULULRRURRRDRRRRRRRRRRLDR

Output: BUG

Input: RLRRRRRDRRDRRRRDLRRRRRRRDLRLDDLRRRRLDLDRDRRRRDRDRDRDLRRURRLRRRRDRRRRRRRRLDDRLRRDRRRRRRRDRDRLDRDDDRDR

Output: BUG

Input: DDUL

Output: BUG

Input: UUULLLLRDD

Output: BUG

Input: LLLLLLLLRRRRDDDDDDDUUUUUU

Output: BUG

Input: DDDDDDDDDDDDUUUUUUUUUUUURRRRRRRRRRRRRLLLLLLLLLLLLLLL

Output: BUG

Input: DDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLLRRRRRRRRRRRRRRRRRRRRRRRRRRRUUUUUUUUUUUUUUUUUUUUUUUU

Output: BUG

Input: DLUR

Output: BUG

Input: UUUURDLLLL

Output: BUG

Input: RRRRRRRRRRRURLLLLLLLLLLLL

Output: BUG

Input: LLLLLLLLLLLLLLLLLLLLLLLLLLRUUUUUUUUUUUUUUUUUUUUUUUUU

Output: BUG

Input: UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUURDRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

Output: BUG

Input: DDLDRRR

Output: BUG

Input: RRUULLD

Output: BUG

Input: LUUUULLLLDDDDRRRD

Output: BUG

Input: DDDDLLLDDDRRRUURRRR

Output: BUG

Input: DDDDDDDLLDDRRURRRRRRR

Output: BUG

Input: DDDDDDDDDDLLLLLLLLLLLDDDDDDDDDDDRRRRRRRRRRRUUUUUUUUUURRRRRRRRRR

Output: BUG

Input: DDDLLLLLLLDDDDDDDRRRRRRRUUUUUURRR

Output: BUG

Input: RRRUUULLLDD

Output: BUG

Input: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLLLDDDDRRRRUUURRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

Output: BUG

Input: RRRRRRRRRRRDDDDDDDDDDDDDDDDDDDRRRRRRRRRRRRRRRRRRRUUUUUUUUUUUUUUUUUUULLLLLLLLLLLLLLLLLLUUUUUUUUUUU

Output: BUG


Yakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors. Wakko thought about Tasmania, its beaches, sun and sea. Dot chose Transylvania as the most mysterious and unpredictable place.But to their great regret, the leave turned to be very short, so it will be enough to visit one of the three above named places. That's why Yakko, as the cleverest, came up with a truly genius idea: let each of the three roll an ordinary six-sided die, and the one with the highest amount of points will be the winner, and will take the other two to the place of his/her dreams.Yakko thrown a die and got Y points, Wakko — W points. It was Dot's turn. But she didn't hurry. Dot wanted to know for sure what were her chances to visit Transylvania.It is known that Yakko and Wakko are true gentlemen, that's why if they have the same amount of points with Dot, they will let Dot win.

NoteDot will go to Transylvania, if she is lucky to roll 4, 5 or 6 points.

The only line of the input file contains two natural numbers Y and W — the results of Yakko's and Wakko's die rolls.

Output the required probability in the form of irreducible fraction in format «A/B», where A — the numerator, and B — the denominator. If the required probability equals to zero, output «0/1». If the required probability equals to 1, output «1/1».

Input: 4 2

Output: 1/2

Input: 1 1

Output: 1/1

Input: 1 2

Output: 5/6

Input: 1 3

Output: 2/3

Input: 1 4

Output: 1/2

Input: 1 5

Output: 1/3

Input: 1 6

Output: 1/6

Input: 2 1

Output: 5/6

Input: 2 2

Output: 5/6

Input: 2 3

Output: 2/3

Input: 2 4

Output: 1/2

Input: 2 5

Output: 1/3

Input: 2 6

Output: 1/6

Input: 3 1

Output: 2/3

Input: 3 2

Output: 2/3

Input: 3 3

Output: 2/3

Input: 3 4

Output: 1/2

Input: 3 5

Output: 1/3

Input: 3 6

Output: 1/6

Input: 4 1

Output: 1/2

Input: 4 3

Output: 1/2

Input: 4 4

Output: 1/2

Input: 4 5

Output: 1/3

Input: 4 6

Output: 1/6

Input: 5 1

Output: 1/3

Input: 5 2

Output: 1/3

Input: 5 3

Output: 1/3

Input: 5 4

Output: 1/3

Input: 5 5

Output: 1/3

Input: 5 6

Output: 1/6

Input: 6 1

Output: 1/6

Input: 6 2

Output: 1/6

Input: 6 3

Output: 1/6

Input: 6 4

Output: 1/6

Input: 6 5

Output: 1/6

Input: 6 6

Output: 1/6


One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of n different natural numbers from 1 to n to obtain total control over her energy.But his plan failed. The reason for this was very simple: Hexadecimal didn't perceive any information, apart from numbers written in binary format. This means that if a number in a decimal representation contained characters apart from 0 and 1, it was not stored in the memory. Now Megabyte wants to know, how many numbers were loaded successfully.

NoteFor n = 10 the answer includes numbers 1 and 10.

Input data contains the only number n (1 ≤ n ≤ 109).

Output the only number — answer to the problem.


In one very old text file there was written Great Wisdom. This Wisdom was so Great that nobody could decipher it, even Phong — the oldest among the inhabitants of Mainframe. But still he managed to get some information from there. For example, he managed to learn that User launches games for pleasure — and then terrible Game Cubes fall down on the city, bringing death to those modules, who cannot win the game...For sure, as guard Bob appeared in Mainframe many modules stopped fearing Game Cubes. Because Bob (as he is alive yet) has never been defeated by User, and he always meddles with Game Cubes, because he is programmed to this.However, unpleasant situations can happen, when a Game Cube falls down on Lost Angles. Because there lives a nasty virus — Hexadecimal, who is... mmm... very strange. And she likes to play very much. So, willy-nilly, Bob has to play with her first, and then with User.This time Hexadecimal invented the following entertainment: Bob has to leap over binary search trees with n nodes. We should remind you that a binary search tree is a binary tree, each node has a distinct key, for each node the following is true: the left sub-tree of a node contains only nodes with keys less than the node's key, the right sub-tree of a node contains only nodes with keys greater than the node's key. All the keys are different positive integer numbers from 1 to n. Each node of such a tree can have up to two children, or have no children at all (in the case when a node is a leaf).In Hexadecimal's game all the trees are different, but the height of each is not lower than h. In this problem «height» stands for the maximum amount of nodes on the way from the root to the remotest leaf, the root node and the leaf itself included. When Bob leaps over a tree, it disappears. Bob gets the access to a Cube, when there are no trees left. He knows how many trees he will have to leap over in the worst case. And you?

The input data contains two space-separated positive integer numbers n and h (n ≤ 35, h ≤ n).

Output one number — the answer to the problem. It is guaranteed that it does not exceed 9·1018.

Input: 3 2

Output: 5

Input: 3 3

Output: 4

Input: 1 1

Output: 1

Input: 2 1

Output: 2

Input: 2 2

Output: 2

Input: 27 11

Output: 61162698256896

Input: 32 27

Output: 22643872890880

Input: 4 1

Output: 14

Input: 9 1

Output: 4862

Input: 33 4

Output: 212336130412243110

Input: 4 4

Output: 8

Input: 8 5

Output: 1336

Input: 12 8

Output: 127200

Input: 15 5

Output: 9694844

Input: 19 18

Output: 2424832

Input: 23 17

Output: 19649347584

Input: 27 15

Output: 25162319484928

Input: 29 14

Output: 577801978306560

Input: 33 18

Output: 54307238601375744

Input: 7 7

Output: 64

Input: 23 21

Output: 275251200

Input: 7 3

Output: 429

Input: 21 18

Output: 211156992

Input: 21 12

Output: 12153990144

Input: 35 13

Output: 2690352397519398400

Input: 19 2

Output: 1767263190

Input: 33 26

Output: 434871797284864

Input: 16 9

Output: 25607552

Input: 16 14

Output: 1032192

Input: 10 2

Output: 16796

Input: 33 17

Output: 75307983624118272

Input: 27 25

Output: 6081740800

Input: 20 14

Output: 1094473728

Input: 16 11

Output: 11819008

Input: 10 10

Output: 512

Input: 4 3

Output: 14

Input: 33 21

Output: 14830955929665536

Input: 24 20

Output: 8171945984

Input: 30 16

Output: 1375710400053248

Input: 9 4

Output: 4862

Input: 16 5

Output: 35357670

Input: 22 22

Output: 2097152

Input: 28 23

Output: 739948625920

Input: 34 1

Output: 812944042149730764

Input: 7 4

Output: 428

Input: 14 11

Output: 488448

Input: 35 1

Output: 3116285494907301262

Input: 35 35

Output: 17179869184


Not long ago Billy came across such a problem, where there were given three natural numbers A, B and C from the range [1, N], and it was asked to check whether the equation AB = C is correct. Recently Billy studied the concept of a digital root of a number. We should remind you that a digital root d(x) of the number x is the sum s(x) of all the digits of this number, if s(x) ≤ 9, otherwise it is d(s(x)). For example, a digital root of the number 6543 is calculated as follows: d(6543) = d(6 + 5 + 4 + 3) = d(18) = 9. Billy has counted that the digital root of a product of numbers is equal to the digital root of the product of the factors' digital roots, i.e. d(xy) = d(d(x)d(y)). And the following solution to the problem came to his mind: to calculate the digital roots and check if this condition is met. However, Billy has doubts that this condition is sufficient. That's why he asks you to find out the amount of test examples for the given problem such that the algorithm proposed by Billy makes mistakes.

NoteFor the first sample the required triples are (3, 4, 3) and (4, 3, 3).

The first line contains the only number N (1 ≤ N ≤ 106).

Output one number — the amount of required A, B and C from the range [1, N].


Jack is working on his jumping skills recently. Currently he's located at point zero of the number line. He would like to get to the point x. In order to train, he has decided that he'll first jump by only one unit, and each subsequent jump will be exactly one longer than the previous one. He can go either left or right with each jump. He wonders how many jumps he needs to reach x.

The input data consists of only one integer x ( - 109 ≤ x ≤ 109).

Output the minimal number of jumps that Jack requires to reach x.


There is a very secret base in Potatoland where potato mash is made according to a special recipe. The neighbours from Porridgia decided to seize this recipe and to sell it to Pilauland. For this mission they have been preparing special agent Pearlo for many years. When, finally, Pearlo learned all secrets of espionage, he penetrated into the Potatoland territory and reached the secret base.Now he is standing at the entrance, but to get inside he need to pass combination lock. Minute ago one of the workers entered the password on the terminal and opened the door. The terminal is a square digital keyboard 3 × 3 with digits from 1 to 9.Pearlo knows that the password consists from distinct digits and is probably symmetric with respect to the central button of the terminal. He has heat sensor which allowed him to detect the digits which the worker pressed. Now he wants to check whether the password entered by the worker is symmetric with respect to the central button of the terminal. This fact can Help Pearlo to reduce the number of different possible password combinations.

NoteIf you are not familiar with the term «central symmetry», you may look into http://en.wikipedia.org/wiki/Central_symmetry

Input contains the matrix of three rows of three symbols each. Symbol «X» means that the corresponding button was pressed, and «.» means that is was not pressed. The matrix may contain no «X», also it may contain no «.».

Print YES if the password is symmetric with respect to the central button of the terminal and NO otherwise.

Input:
XX.
...
.XX

Output: YES

Input:
X.X
X..
...

Output: NO

Output: YES

Input:
.X.
.X.
.X.

Output: YES

Input:
XXX
XXX
XXX

Output: YES

Input:
XXX
X.X
XXX

Output: YES

Input:
X..
.X.
..X

Output: YES

Input:
...
X.X
X..

Output: NO

Input:
.X.
X.X
.X.

Output: YES

Input:
X.X
.X.
X.X

Output: YES

Input:
...
...
..X

Output: NO

Input:
...
.X.
...

Output: YES

Input:
XXX
...
XXX

Output: YES

Input:
...
XXX
...

Output: YES

Input:
..X
X..
..X

Output: NO

Input:
.X.
...
X.X

Output: NO

Input:
X.X
X.X
X.X

Output: YES

Input:
.X.
X.X
XX.

Output: NO

Input:
...
XXX
XXX

Output: NO

Input:
...
X.X
...

Output: YES

Input:
XXX
..X
XXX

Output: NO

Input:
X..
X.X
.X.

Output: NO

Input:
...
..X
XXX

Output: NO

Input:
..X
X.X
X..

Output: YES

Input:
..X
..X
XXX

Output: NO

Input:
X..
X..
X..

Output: NO

Input:
XXX
.X.
...

Output: NO

Input:
XXX
.X.
XXX

Output: YES

Input:
X..
...
...

Output: NO

Input:
..X
...
X..

Output: YES

Input:
.X.
...
...

Output: NO

Input:
..X
...
...

Output: NO

Input:
...
X..
...

Output: NO

Input:
...
..X
...

Output: NO

Input:
...
...
X..

Output: NO

Input:
...
...
.X.

Output: NO

Input:
...
.X.
X..

Output: NO


One cold winter evening Alice and her older brother Bob was sitting at home near the fireplace and giving each other interesting problems to solve. When it was Alice's turn, she told the number n to Bob and said:—Shuffle the digits in this number in order to obtain the smallest possible number without leading zeroes.—No problem! — said Bob and immediately gave her an answer.Alice said a random number, so she doesn't know whether Bob's answer is correct. Help her to find this out, because impatient brother is waiting for the verdict.

The first line contains one integer n (0 ≤ n ≤ 109) without leading zeroes. The second lines contains one integer m (0 ≤ m ≤ 109) — Bob's answer, possibly with leading zeroes.

Print OK if Bob's answer is correct and WRONG_ANSWER otherwise.

Input:
3310
1033

Output: OK

Input:
4
5

Output: WRONG_ANSWER

Input:
40
04

Output: WRONG_ANSWER

Input:
12
12

Output: OK

Input:
432
234

Output: OK

Input:
17109
01179

Output: WRONG_ANSWER

Input:
888
888

Output: OK

Input:
912
9123

Output: WRONG_ANSWER

Input:
0
00

Output: WRONG_ANSWER

Input:
11110
1111

Output: WRONG_ANSWER

Input:
7391
1397

Output: WRONG_ANSWER

Input:
201
102

Output: OK

Input:
111111111
111111111

Output: OK

Input:
32352320
22203335

Output: WRONG_ANSWER

Input:
1000000000
1

Output: WRONG_ANSWER

Input:
994321
123499

Output: OK

Input:
10101
10101

Output: WRONG_ANSWER

Input:
666
0666

Output: WRONG_ANSWER

Input:
2
02

Output: WRONG_ANSWER

Input:
313
133

Output: OK

Input:
987235645
234556789

Output: OK

Input:
90812
010289

Output: WRONG_ANSWER

Input:
123
321

Output: WRONG_ANSWER

Input:
707
770

Output: WRONG_ANSWER

Input:
77774444
47474747

Output: WRONG_ANSWER

Input:
1270
1027

Output: OK

Input:
320
23

Output: WRONG_ANSWER

Input:
123456789
123456789

Output: OK

Input:
918273645
546372819

Output: WRONG_ANSWER

Input:
300000003
30000003

Output: WRONG_ANSWER

Input:
0
0

Output: OK

Input:
0
7

Output: WRONG_ANSWER


Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the program detects if the four given segments form a rectangle of a positive area and with sides parallel to coordinate axes. As Alex does badly at school and can't write this program by himself, he asks you to help him.

The input data contain four lines. Each of these lines contains four integers x1, y1, x2, y2 ( - 109 ≤ x1, y1, x2, y2 ≤ 109) — coordinates of segment's beginning and end positions. The given segments can degenerate into points.

Output the word «YES», if the given four segments form the required rectangle, otherwise output «NO».

Input:
1 1 6 1
1 0 6 0
6 0 6 1
1 1 1 0

Output: YES

Input:
0 0 0 3
2 0 0 0
2 2 2 0
0 2 2 2

Output: NO

Input:
0 0 0 2
2 0 0 0
2 2 2 0
0 2 2 2

Output: YES

Input:
0 0 10 0
0 0 10 0
0 0 0 5
0 0 0 -5

Output: NO

Input:
0 0 4 0
4 0 3 0
3 0 2 0
2 0 0 0

Output: NO

Input:
0 0 3 0
0 0 0 3
0 3 3 3
3 3 3 0

Output: YES

Input:
0 0 1 0
1 0 1 1
0 1 1 1
0 0 0 1

Output: YES

Input:
0 0 1 0
1 0 1 1
1 1 1 0
1 0 0 0

Output: NO

Input:
0 0 1 1
1 1 2 0
2 0 1 -1
1 -1 0 0

Output: NO

Input:
0 0 0 10
0 10 0 9
0 9 0 8
0 8 0 0

Output: NO

Input:
0 0 4 0
4 0 4 0
4 0 0 0
0 0 0 0

Output: NO

Input:
0 0 0 2
0 2 2 2
0 0 2 2
2 2 2 0

Output: NO

Input:
0 0 0 2
2 0 2 2
0 2 0 0
2 2 2 0

Output: NO

Input:
13 13 13 13
13 13 13 13
13 13 13 13
13 13 13 13

Output: NO

Input:
0 0 2 0
0 1 0 3
0 4 3 4
3 0 3 3

Output: NO

Input:
1 1 1 1
0 1 -1 1
-1 1 1 1
-1 1 1 1

Output: NO

Input:
1 -1 1 -1
1 -1 1 -1
1 -1 1 -1
1 -1 1 -1

Output: NO

Input:
-1 0 -1 0
-1 0 -1 0
-1 0 -1 0
-1 0 -1 0

Output: NO

Input:
0 -1 0 1
0 0 0 1
0 -1 0 -1
0 -1 0 -1

Output: NO

Input:
0 0 -1 0
-1 0 0 0
-1 0 -1 0
-1 0 -1 0

Output: NO

Input:
0 0 0 0
0 0 0 1
0 0 0 1
0 0 0 0

Output: NO

Input:
-1 1 -1 1
-1 1 -1 1
-1 1 -1 1
-1 1 -1 1

Output: NO

Input:
-1 1 -1 1
0 1 1 1
1 -1 -1 1
-1 1 1 1

Output: NO

Input:
-1 -1 -1 -1
-1 0 -1 0
-1 0 -1 0
-1 -1 -1 -1

Output: NO

Input:
1 2 1 2
-2 2 1 2
1 -2 -2 2
-2 -2 1 -2

Output: NO

Input:
-2 1 -2 -1
-2 -2 -2 -2
-2 -1 -2 -2
-2 1 -2 -1

Output: NO

Input:
1 2 1 2
1 -1 1 -1
1 -1 1 -1
1 -1 1 -1

Output: NO

Input:
-2 0 -2 -1
-2 2 -2 0
-2 2 -2 2
-2 0 -2 -1

Output: NO

Input:
-1 1 -2 1
0 -1 -1 1
-2 1 -1 -1
0 1 0 -1

Output: NO

Input:
2 -1 -2 -1
2 -1 2 -1
2 -1 -2 -1
2 -1 2 -1

Output: NO

Input:
0 2 0 2
0 2 0 1
0 1 0 1
0 2 0 1

Output: NO

Input:
1 0 1 0
1 0 1 0
1 0 0 0
1 0 1 0

Output: NO

Input:
-1 1 2 1
0 1 0 1
0 1 2 1
2 1 -1 1

Output: NO

Input:
0 0 2 0
0 0 2 0
0 -2 0 0
0 -2 0 0

Output: NO

Input:
0 -3 0 -1
1 -1 1 -1
0 -1 1 -2
0 -2 -2 -3

Output: NO

Input:
-3 -2 -2 -2
3 -2 3 -2
-3 -2 -2 -2
3 -2 3 -2

Output: NO

Input:
1 2 -2 2
-2 2 3 2
1 2 -2 2
-2 2 3 2

Output: NO

Input:
0 -2 1 3
1 3 1 3
1 3 1 3
1 3 1 -2

Output: NO

Input:
0 -3 -2 -3
0 1 0 -3
0 1 0 -3
0 1 0 -3

Output: NO

Input:
1 -3 1 -3
1 -3 1 -3
1 -3 1 -3
1 -3 1 -3

Output: NO

Input:
-3 2 -2 1
0 2 0 -3
0 -3 -2 1
0 1 -3 -3

Output: NO

Input:
-3 3 2 3
2 3 2 3
-3 3 -3 3
-3 3 2 3

Output: NO

Input:
2 -2 2 -2
2 -2 2 -2
2 -2 2 -2
2 -2 2 -2

Output: NO

Input:
2 -1 0 -2
-3 -2 -3 3
2 -2 2 -2
0 3 -3 -2

Output: NO

Input:
1 -3 -1 1
0 -2 1 -3
1 1 0 1
1 -3 0 1

Output: NO

Input:
-2 4 -2 4
-2 4 -2 -2
-2 4 -2 -2
-2 4 -2 -2

Output: NO

Input:
3 1 3 1
-3 1 3 1
3 3 -3 1
-3 1 3 1

Output: NO

Input:
0 1 4 1
0 1 4 1
4 1 0 1
0 -2 4 1

Output: NO

Input:
0 -2 0 -1
0 -1 0 -2
0 -2 0 -2
0 -2 0 -2

Output: NO

Input:
-1 1 -1 1
-1 1 -1 1
-1 1 -1 3
-3 1 -3 1

Output: NO

Input:
578327678 518066351 578327678 498442467
583129774 498442467 578327678 518066351
583129774 518066351 578327678 518066351
583129774 498442467 578327678 518066351

Output: NO

Input:
-973576966 32484917 -973576966 32484917
-973576966 32484917 347173379 32484917
-973576966 32484917 347173379 32484917
-973576966 32484917 347173379 32484917

Output: NO

Input:
572793036 194804279 572793036 -866298887
572793036 461349977 -860420833 194804279
572793036 461349977 572793036 -866298887
-860420833 461349977 572793036 -866298887

Output: NO

Input:
949753871 -467933239 -72251156 462207752
949753871 462207752 425479768 -467933239
425479768 462207752 425479768 -467933239
949753871 -467933239 949753871 462207752

Output: NO

Input:
1 -1 1 -1
-1 -1 -1 -1
1 0 -1 -1
1 -1 -1 -1

Output: NO

Input:
1 -1 1 -1
1 0 1 0
1 0 1 -1
1 0 1 -1

Output: NO

Input:
0 0 0 1
0 1 0 1
0 1 0 0
0 1 0 1

Output: NO

Input:
1 -1 1 0
1 0 1 0
0 0 0 -1
1 -1 1 0

Output: NO

Input:
0 0 2 2
0 0 2 0
2 2 2 2
0 2 0 2

Output: NO

Input:
-2 -1 -1 -1
-2 -1 -1 -1
-2 -1 -2 2
-2 2 -1 2

Output: NO

Input:
2 1 -1 0
-1 0 2 1
2 1 2 1
-1 0 2 1

Output: NO

Input:
1 -1 2 -1
1 -2 2 -2
1 -2 2 -2
1 -2 2 -2

Output: NO

Input:
-1 -2 -1 2
-1 -2 -1 -2
-1 2 -1 2
-1 -2 -1 -2

Output: NO

Input:
2 0 2 -1
2 -1 -1 0
2 -1 -1 0
2 -1 -1 0

Output: NO

Input:
2 -3 1 3
1 -3 1 3
2 3 2 -3
2 -3 2 -3

Output: NO

Input:
130120899 550158649 130120899 831843953
130120899 550158649 130120899 831843953
130120899 550158649 434006978 831843953
434006978 550158649 434006978 550158649

Output: NO

Input:
-214484034 559719641 -214484034 559719641
-214484034 559719641 -214484034 559719641
-214484034 2764087 -214484034 559719641
-214484034 2764087 734280017 2764087

Output: NO

Input:
-966947426 664261857 -994206270 664261857
-966947426 664261857 -994206270 664261857
-966947426 789165019 -966947426 789165019
-966947426 664261857 -966947426 789165019

Output: NO

Input:
264411509 -329579381 264411509 -329579381
-726758913 -329579381 264411509 357369289
-726758913 -329579381 264411509 -329579381
264411509 -329579381 264411509 -329579381

Output: NO

Input:
-193720583 -547078093 -570748852 58725936
-570748852 -547078093 -570748852 58725936
-193720583 58725936 -570748852 -547078093
-570748852 -547078093 -193720583 58725936

Output: NO

Input:
-534094150 -333730697 120658438 -333730697
-534094150 -333730697 120658438 869464313
-534094150 -333730697 -534094150 -333730697
-534094150 869464313 -534094150 -333730697

Output: NO

Input:
-328545071 835751660 -345950135 835751660
-345950135 243569491 -328545071 835751660
-328545071 835751660 -345950135 243569491
-328545071 243569491 -328545071 243569491

Output: NO

Input:
-985236057 -809433993 -985236057 -225363622
-484344733 -225363622 -484344733 -225363622
-985236057 -225363622 -985236057 -809433993
-484344733 -225363622 -484344733 -809433993

Output: NO

Input:
774287068 919049158 774287068 919049158
250033372 653817677 250033372 653817677
250033372 919049158 774287068 653817677
250033372 653817677 250033372 653817677

Output: NO

Input:
15319063 -661389770 632904085 -661389770
15319063 834266473 632904085 834266473
15319063 834266473 15319063 -661389770
632904085 -661389770 632904085 834266473

Output: YES

Input:
157550209 -594704878 157550209 524666828
671878188 -594704878 157550209 -594704878
671878188 -594704878 671878188 524666828
671878188 524666828 157550209 524666828

Output: YES

Input:
-887135208 728202342 127569272 728202342
127569272 728202342 127569272 -932260532
-887135208 -932260532 -887135208 728202342
127569272 -932260532 -887135208 -932260532

Output: YES

Input:
-777411660 -392696120 -777411660 878250237
461320023 878250237 -777411660 878250237
461320023 878250237 461320023 -392696120
461320023 -392696120 -777411660 -392696120

Output: YES

Input:
-892785315 567101756 -892785315 212349618
-403060667 212349618 -403060667 567101756
-403060667 567101756 -892785315 567101756
-892785315 212349618 -403060667 212349618

Output: YES

Input:
-360046034 -871603961 -37695563 -871603961
-37695563 664955871 -37695563 -871603961
-360046034 664955871 -360046034 -871603961
-360046034 664955871 -37695563 664955871

Output: YES

Input:
375089524 -852468724 -952575952 -852468724
-952575952 -852468724 -952575952 -883150295
-952575952 -883150295 375089524 -883150295
375089524 -852468724 375089524 -883150295

Output: YES

Input:
851113265 -893293930 851113265 -444742025
-864765585 -893293930 -864765585 -444742025
-864765585 -893293930 851113265 -893293930
-864765585 -444742025 851113265 -444742025

Output: YES

Input:
-309306779 559081237 255096743 559081237
-309306779 -359724178 255096743 -359724178
255096743 -359724178 255096743 559081237
-309306779 559081237 -309306779 -359724178

Output: YES

Input:
542957347 -480242202 566995046 -480242202
542957347 -480242202 542957347 -298569507
566995046 -298569507 542957347 -298569507
566995046 -298569507 566995046 -480242202

Output: YES

Input:
724715871 -943657730 964573294 -943657730
724715871 -943657730 724715871 -216459206
964573294 -216459206 964573294 -943657730
724715871 -216459206 964573294 -216459206

Output: YES

Input:
-394306310 -279360055 -394306310 771835446
-394306310 -279360055 -358661829 -279360055
-358661829 771835446 -358661829 -279360055
-358661829 771835446 -394306310 771835446

Output: YES

Input:
-204472047 -894485730 -204472047 640004355
960702643 -894485730 960702643 640004355
960702643 -894485730 -204472047 -894485730
-204472047 640004355 960702643 640004355

Output: YES

Input:
747591 5158024 -837871358 5158024
-837871358 -874026904 747591 -874026904
747591 -874026904 747591 5158024
-837871358 -874026904 -837871358 5158024

Output: YES

Input:
-442585231 90863587 800882871 90863587
800882871 288218107 800882871 90863587
800882871 288218107 -442585231 288218107
-442585231 90863587 -442585231 288218107

Output: YES

Input:
-969490772 476931470 -969490772 929999730
-426216863 929999730 -969490772 929999730
-426216863 929999730 -426216863 476931470
-969490772 476931470 -426216863 476931470

Output: YES

Input:
-683046010 -125472203 -683046010 418507423
817863270 418507423 817863270 -125472203
817863270 418507423 -683046010 418507423
817863270 -125472203 -683046010 -125472203

Output: YES

Input:
231996287 974811621 -923122611 974811621
-923122611 646880519 -923122611 974811621
231996287 646880519 231996287 974811621
-923122611 646880519 231996287 646880519

Output: YES

Input:
-83429272 -350159212 -990378619 -350159212
-990378619 -350159212 -990378619 247777831
-83429272 -350159212 -83429272 247777831
-990378619 247777831 -83429272 247777831

Output: YES

Input:
-679599706 974881765 -679599706 -84192294
-554774137 -84192294 -554774137 974881765
-554774137 974881765 -679599706 974881765
-554774137 -84192294 -679599706 -84192294

Output: YES

Input:
-155221108 -190475340 -155221108 -819044368
-155221108 -190475340 -155875856 -190475340
-155875856 -190475340 -155875856 -819044368
-155875856 -819044368 -155221108 -819044368

Output: YES

Input:
377126871 -877660066 -633390329 -877660066
377126871 -175686511 377126871 -877660066
-633390329 -877660066 -633390329 -175686511
-633390329 -175686511 377126871 -175686511

Output: YES

Input:
919022298 897009314 77151365 897009314
77151365 579795002 919022298 579795002
77151365 579795002 77151365 897009314
919022298 579795002 919022298 897009314

Output: YES

Input:
146411776 -188986353 146411776 -808042296
-381166510 -808042296 -381166510 -188986353
146411776 -188986353 -381166510 -188986353
146411776 -808042296 -381166510 -808042296

Output: YES

Input:
438703475 871560515 571565350 871560515
571565350 -204157747 438703475 -204157747
438703475 -204157747 438703475 871560515
571565350 -204157747 571565350 871560515

Output: YES

Input:
0 0 0 0
5 5 5 5
5 0 5 5
0 5 0 0

Output: NO

Input:
0 1 1 2
2 1 1 2
1 0 0 1
2 1 1 0

Output: NO

Input:
-3 0 -3 3
0 0 0 3
3 3 -3 3
3 0 -3 0

Output: NO

Input:
0 0 0 0
1 1 1 1
0 1 0 1
1 0 1 0

Output: NO

Input:
0 0 0 0
0 0 0 1
0 0 1 0
1 1 1 1

Output: NO

Input:
0 0 1 0
1 1 0 1
0 0 1 0
1 1 0 1

Output: NO

Input:
0 0 0 1
0 1 1 1
1 1 1 0
1 0 0 1

Output: NO

Input:
0 0 1 1
0 1 1 0
1 1 0 0
1 0 0 1

Output: NO

Input:
0 0 0 0
1 1 1 1
0 1 1 0
1 0 0 1

Output: NO

Input:
0 0 1 0
0 1 1 1
0 0 1 0
0 1 1 1

Output: NO


Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by the fear of the wolf, but by a strange, in his opinion, pattern of the forest that has n levels, where n is an even number.In the local council you were given an area map, where the granny's house is marked by point H, parts of dense forest are marked grey (see the picture to understand better).After a long time at home Peter decided to yield to his granny's persuasions and step out for a breath of fresh air. Being prudent, Peter plans the route beforehand. The route, that Peter considers the most suitable, has the following characteristics:   it starts and ends in the same place — the granny's house;  the route goes along the forest paths only (these are the segments marked black in the picture);  the route has positive length (to step out for a breath of fresh air Peter has to cover some distance anyway);  the route cannot cross itself;  there shouldn't be any part of dense forest within the part marked out by this route; You should find the amount of such suitable oriented routes modulo 1000000009.  The example of the area map for n = 12 is given in the picture. Since the map has a regular structure, you can construct it for other n by analogy using the example.

The input data contain the only even integer n (2 ≤ n ≤ 106).

Output the only number — the amount of Peter's routes modulo 1000000009.


Reca company makes monitors, the most popular of their models is AB999 with the screen size a × b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popular with users. That's why the company wants to reduce monitor AB999 size so that its screen sides ratio becomes x: y, at the same time they want its total area to be maximal of all possible variants. Your task is to find the screen parameters of the reduced size model, or find out that such a reduction can't be performed.

The first line of the input contains 4 integers — a, b, x and y (1 ≤ a, b, x, y ≤ 2·109).

If the answer exists, output 2 positive integers — screen parameters of the reduced size model. Output 0 0 otherwise.

Input: 800 600 4 3

Output: 800 600

Input: 1920 1200 16 9

Output: 1920 1080

Input: 1 1 1 2

Output: 0 0

Input: 1002105126 227379125 179460772 1295256518

Output: 0 0

Input: 625166755 843062051 1463070160 1958300154

Output: 0 0

Input: 248228385 1458744978 824699604 1589655888

Output: 206174901 397413972

Input: 186329049 1221011622 90104472 1769702163

Output: 60069648 1179801442

Input: 511020182 242192314 394753578 198572007

Output: 394753578 198572007

Input: 134081812 857875240 82707261 667398699

Output: 105411215 850606185

Input: 721746595 799202881 143676564 380427290

Output: 287353128 760854580

Input: 912724694 1268739154 440710604 387545692

Output: 881421208 775091384

Input: 1103702793 1095784840 788679477 432619528

Output: 788679477 432619528

Input: 548893795 861438648 131329677 177735812

Output: 525318708 710943248

Input: 652586118 1793536161 127888702 397268645

Output: 511554808 1589074580

Input: 756278440 578150025 96644319 26752094

Output: 676510233 187264658

Input: 859970763 1510247537 37524734 97452508

Output: 562871010 1461787620

Input: 547278097 1977241684 51768282 183174370

Output: 543566961 1923330885

Input: 62256611 453071697 240966 206678

Output: 62169228 53322924

Input: 1979767797 878430446 5812753 3794880

Output: 1342745943 876617280

Input: 1143276347 1875662241 178868040 116042960

Output: 1140283755 739773870

Input: 435954880 1740366589 19415065 185502270

Output: 182099920 1739883360

Input: 664035593 983601098 4966148 2852768

Output: 664032908 381448928

Input: 1461963719 350925487 135888396 83344296

Output: 572153868 350918568

Input: 754199095 348965411 161206703 67014029

Output: 754119492 313489356

Input: 166102153 494841162 14166516 76948872

Output: 91096406 494812252

Input: 1243276346 1975662240 38441120 291740200

Output: 259477560 1969246350

Input: 535954879 1840366588 26278959 73433046

Output: 535849118 1497358892

Input: 764035592 1083601097 1192390 7267738

Output: 177777265 1083570463

Input: 1561963718 450925486 475523188 136236856

Output: 1561914768 447486816

Input: 854199094 448965410 364102983 125971431

Output: 853687785 295356745

Input: 266102152 594841161 15854566 13392106

Output: 266043102 224722482

Input: 1 1 2 1

Output: 0 0

Input: 2000000000 2000000000 1 1999999999

Output: 1 1999999999

Input: 2000000000 2000000000 1999999999 1

Output: 1999999999 1

Input: 2000000000 2000000000 2 1999999999

Output: 2 1999999999

Input: 1000000000 1000000000 999999999 2

Output: 999999999 2

Input: 2000000000 2000000000 1999999999 2

Output: 1999999999 2

Input: 2000000000 2000000000 1999999999 1999999998

Output: 1999999999 1999999998

Input: 2000000000 2000000000 1999999998 1999999999

Output: 1999999998 1999999999

Input: 1002105126 227379125 101440715 179460772

Output: 101440715 179460772

Input: 18773663 74427904 186329049 1221011622

Output: 0 0

Input: 912724694 21235685 356014460 15587143

Output: 356014460 15587143


Nick is interested in prime numbers. Once he read about Goldbach problem. It states that every even integer greater than 2 can be expressed as the sum of two primes. That got Nick's attention and he decided to invent a problem of his own and call it Noldbach problem. Since Nick is interested only in prime numbers, Noldbach problem states that at least k prime numbers from 2 to n inclusively can be expressed as the sum of three integer numbers: two neighboring prime numbers and 1. For example, 19 = 7 + 11 + 1, or 13 = 5 + 7 + 1.Two prime numbers are called neighboring if there are no other prime numbers between them.You are to help Nick, and find out if he is right or wrong.

NoteIn the first sample the answer is YES since at least two numbers can be expressed as it was described (for example, 13 and 19). In the second sample the answer is NO since it is impossible to express 7 prime numbers from 2 to 45 in the desired form.

The first line of the input contains two integers n (2 ≤ n ≤ 1000) and k (0 ≤ k ≤ 1000).

Output YES if at least k prime numbers from 2 to n inclusively can be expressed as it was described above. Otherwise output NO.

Input: 27 2

Output: YES

Input: 45 7

Output: NO

Input: 2 0

Output: YES

Input: 15 1

Output: YES

Input: 17 1

Output: YES

Input: 34 5

Output: NO

Input: 37 4

Output: YES

Input: 43 5

Output: YES

Input: 47 7

Output: NO

Input: 50 5

Output: YES

Input: 57 6

Output: YES

Input: 60 8

Output: NO

Input: 62 7

Output: YES

Input: 76 9

Output: NO

Input: 69 7

Output: YES

Input: 113 10

Output: YES

Input: 141 11

Output: YES

Input: 207 16

Output: NO

Input: 231 18

Output: NO

Input: 296 19

Output: YES

Input: 332 20

Output: YES

Input: 378 24

Output: NO

Input: 428 23

Output: YES

Input: 497 27

Output: NO

Input: 640 32

Output: YES

Input: 798 35

Output: YES

Input: 802 35

Output: YES

Input: 864 40

Output: NO

Input: 953 44

Output: NO

Input: 995 44

Output: YES

Input: 1000 44

Output: YES

Input: 1000 0

Output: YES

Input: 1000 1000

Output: NO

Input: 2 1000

Output: NO


A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are m containers, in the i-th container there are ai matchboxes, and each matchbox contains bi matches. All the matchboxes are of the same size. The burglar's rucksack can hold n matchboxes exactly. Your task is to find out the maximum amount of matches that a burglar can carry away. He has no time to rearrange matches in the matchboxes, that's why he just chooses not more than n matchboxes so that the total amount of matches in them is maximal.

The first line of the input contains integer n (1 ≤ n ≤ 2·108) and integer m (1 ≤ m ≤ 20). The i + 1-th line contains a pair of numbers ai and bi (1 ≤ ai ≤ 108, 1 ≤ bi ≤ 10). All the input numbers are integer.

Input:
7 3
5 10
2 5
3 6

Output: 62

Input:
3 3
1 3
2 2
3 1

Output: 7

Input:
1 1
1 2

Output: 2

Input:
1 2
1 9
1 6

Output: 9

Input:
1 10
1 1
1 9
1 3
1 9
1 7
1 10
1 4
1 7
1 3
1 1

Output: 10

Input:
2 1
2 1

Output: 2

Input:
2 2
2 4
1 4

Output: 8

Input:
2 3
1 7
1 2
1 5

Output: 12

Input:
4 1
2 2

Output: 4

Input:
4 2
1 10
4 4

Output: 22

Input:
4 3
1 4
6 4
1 7

Output: 19

Input:
5 1
10 5

Output: 25

Input:
5 2
3 9
2 2

Output: 31

Input:
5 5
2 9
3 1
2 1
1 8
2 8

Output: 42

Input:
5 10
1 3
1 2
1 9
1 10
1 1
1 5
1 10
1 2
1 3
1 7

Output: 41

Input:
10 1
9 4

Output: 36

Input:
10 2
14 3
1 3

Output: 30

Input:
10 7
4 8
1 10
1 10
1 2
3 3
1 3
1 10

Output: 71

Input:
10 10
1 8
2 10
1 9
1 1
1 9
1 6
1 4
2 5
1 2
1 4

Output: 70

Input:
10 4
1 5
5 2
1 9
3 3

Output: 33

Input:
100 5
78 6
29 10
3 6
7 3
2 4

Output: 716

Input:
1000 7
102 10
23 6
79 4
48 1
34 10
839 8
38 4

Output: 8218

Input:
10000 10
336 2
2782 5
430 10
1893 7
3989 10
2593 8
165 6
1029 2
2097 4
178 10

Output: 84715

Input:
100000 3
2975 2
35046 4
61979 9

Output: 703945

Input:
1000000 4
314183 9
304213 4
16864 5
641358 9

Output: 8794569

Input:
10000000 10
360313 10
416076 1
435445 9
940322 7
1647581 7
4356968 10
3589256 2
2967933 5
2747504 7
1151633 3

Output: 85022733

Input:
100000000 7
32844337 7
11210848 7
47655987 1
33900472 4
9174763 2
32228738 10
29947408 5

Output: 749254060

Input:
200000000 10
27953106 7
43325979 4
4709522 1
10975786 4
67786538 8
48901838 7
15606185 6
2747583 1
100000000 1
633331 3

Output: 1332923354

Input:
200000000 9
17463897 9
79520463 1
162407 4
41017993 8
71054118 4
9447587 2
5298038 9
3674560 7
20539314 5

Output: 996523209

Input:
200000000 8
6312706 6
2920548 2
16843192 3
1501141 2
13394704 6
10047725 10
4547663 6
54268518 6

Output: 630991750

Input:
200000000 7
25621043 2
21865270 1
28833034 1
22185073 5
100000000 2
13891017 9
61298710 8

Output: 931584598

Input:
200000000 6
7465600 6
8453505 10
4572014 8
8899499 3
86805622 10
64439238 6

Output: 1447294907

Input:
200000000 5
44608415 6
100000000 9
51483223 9
44136047 1
52718517 1

Output: 1634907859

Input:
200000000 4
37758556 10
100000000 6
48268521 3
20148178 10

Output: 1305347138

Input:
200000000 3
65170000 7
20790088 1
74616133 4

Output: 775444620

Input:
200000000 2
11823018 6
100000000 9

Output: 970938108

Input:
200000000 1
100000000 6

Output: 600000000

Input:
200000000 10
12097724 9
41745972 5
26982098 9
14916995 7
21549986 7
3786630 9
8050858 7
27994924 4
18345001 5
8435339 5

Output: 1152034197

Input:
200000000 10
55649 8
10980981 9
3192542 8
94994808 4
3626106 1
100000000 6
5260110 9
4121453 2
15125061 4
669569 6

Output: 1095537357

Input:
10 20
1 7
1 7
1 8
1 3
1 10
1 7
1 7
1 9
1 3
1 1
1 2
1 1
1 3
1 10
1 9
1 8
1 8
1 6
1 7
1 5

Output: 83

Input:
10000000 20
4594 7
520836 8
294766 6
298672 4
142253 6
450626 1
1920034 9
58282 4
1043204 1
683045 1
1491746 5
58420 4
451217 2
129423 4
246113 5
190612 8
912923 6
473153 6
783733 6
282411 10

Output: 54980855

Input:
200000000 20
15450824 5
839717 10
260084 8
1140850 8
28744 6
675318 3
25161 2
5487 3
6537698 9
100000000 5
7646970 9
16489 6
24627 3
1009409 5
22455 1
25488456 4
484528 9
32663641 3
750968 4
5152 6

Output: 939368573

Input:
200000000 20
16896 2
113 3
277 2
299 7
69383562 2
3929 8
499366 4
771846 5
9 4
1278173 7
90 2
54 7
72199858 10
17214 5
3 10
1981618 3
3728 2
141 8
2013578 9
51829246 5

Output: 1158946383

Input:
200000000 20
983125 2
7453215 9
9193588 2
11558049 7
28666199 1
34362244 1
5241493 5
15451270 4
19945845 8
6208681 3
38300385 7
6441209 8
21046742 7
577198 10
3826434 8
9764276 8
6264675 7
8567063 3
3610303 4
2908232 3

Output: 1131379312

Input:
10 15
1 6
2 6
3 4
1 3
1 2
1 5
1 6
1 2
2 9
1 10
1 3
1 7
1 8
1 2
2 9

Output: 79

Input:
10000000 15
111 5
914124 3
3 9
177790 1
2352 3
32138 9
104477 1
1223 4
18 6
6655580 4
57643 10
94309 2
37 1
227002 10
1733193 7

Output: 45116295

Input:
200000000 15
7069868 1
5567826 8
2310059 10
13539782 7
38420939 4
29911411 8
52256316 1
12265839 9
2074265 1
24896428 9
72470695 5
3236301 1
3890243 2
65168965 8
65724 6

Output: 1489289257

Input:
200000000 15
12044094 7
2475138 10
944451 7
4854766 2
3809145 10
7727571 2
43908937 6
2745883 1
427511 2
100000000 5
190914 6
554889 3
288798 4
1848572 5
893874 3

Output: 961871671

Input:
200000000 15
6334191 7
1927941 4
5175933 10
468389 1
433043 10
6863198 5
7480646 4
14774279 10
2921129 8
18325627 7
6973152 9
8277324 9
21522856 2
2058070 1
2444742 4

Output: 664376069


Nick likes strings very much, he likes to rotate them, sort them, rearrange characters within a string... Once he wrote a random string of characters a, b, c on a piece of paper and began to perform the following operations:   to take two adjacent characters and replace the second character with the first one,  to take two adjacent characters and replace the first character with the second one To understand these actions better, let's take a look at a string «abc». All of the following strings can be obtained by performing one of the described operations on «abc»: «bbc», «abb», «acc». Let's denote the frequency of a character for each of the characters a, b and c as the number of occurrences of this character in the string. For example, for string «abc»: |a| = 1, |b| = 1, |c| = 1, and for string «bbc»: |a| = 0, |b| = 2, |c| = 1. While performing the described operations, Nick sometimes got balanced strings. Let's say that a string is balanced, if the frequencies of each character differ by at most 1. That is  - 1 ≤ |a| - |b| ≤ 1,  - 1 ≤ |a| - |c| ≤ 1 и  - 1 ≤ |b| - |c| ≤ 1. Would you help Nick find the number of different balanced strings that can be obtained by performing the operations described above, perhaps multiple times, on the given string s. This number should be calculated modulo 51123987.

NoteIn the first sample it is possible to get 51 different strings through the described operations, but only 7 of them are balanced: «abca», «bbca», «bcca», «bcaa», «abcc», «abbc», «aabc». In the second sample: «abbc», «aabc», «abcc». In the third sample there is only one balanced string — «ab» itself.

The first line contains integer n (1 ≤ n ≤ 150) — the length of the given string s. Next line contains the given string s. The initial string can be balanced as well, in this case it should be counted too. The given string s consists only of characters a, b and c.

Output the only number — the number of different balanced strings that can be obtained by performing the described operations, perhaps multiple times, on the given string s, modulo 51123987.

Input:
4
abca

Output: 7

Input:
4
abbc

Output: 3

Input:
2
ab

Output: 1

Input:
1
c

Output: 1

Input:
2
cc

Output: 0

Input:
2
ca

Output: 1

Input:
3
aca

Output: 0

Input:
3
abc

Output: 1

Input:
4
cbba

Output: 3

Input:
5
abbcb

Output: 8

Input:
6
bacaac

Output: 5

Input:
6
bccbcc

Output: 0

Input:
7
bacaccb

Output: 62

Input:
8
bbccbbbc

Output: 0

Input:
8
bbbbbacb

Output: 11

Input:
20
cbacabcacbabbcbcaaac

Output: 20404330

Input:
26
aacbcaccacbaaabaaacabcccab

Output: 40491152

Input:
31
bacbabaccacbcaaccacccacabaaccab

Output: 2712522

Input:
43
accabaaabaabaaaaacccbcaabcacbbaaaabcaacaabb

Output: 26173492

Input:
52
cccbccccbacacbcbbbcacbcbccccccbcccacccbcccaaccaaccab

Output: 18131615

Input:
67
babaabacbbbaababbaabaaababccccbbbbcabbccbabbabaaccaabacccabbabbabcb

Output: 23016943

Input:
74
aaaacabaababcaccbbbbabcabccbbbcaacaaacaacacbaaaabcacbccbccbcccaaaccccabcaa

Output: 3100802

Input:
89
bacacccbbcacbcaababbcbcacbbcaacbccbabaaacbcacccccaabccacbabcacacabbcccabcababccccababacaa

Output: 4379010

Input:
95
acccbccbbaccaccccaccabbbcccbaaccacabbccaaaaabcaaacccbbcbccacbccccacbaccaacbcacacccbcbacabcaccba

Output: 35843148

Input:
101
aaaaaaaaaabbaaaaabaaabbacabbaaaabbbaababcabbaaaaabcaaabaabaaaaabbabaabaaaaabcbaabbbbacaababaababaabaa

Output: 11021799

Input:
109
babaaacaacccaababcabbcabacaacbccabcabbaacbcacacacacacbbabbcaacaacaccbcbccbcbcbcabcabcacacabbcbaccbcbaacbcaccc

Output: 2602050

Input:
118
bccaaccacbbbabcbcbbcbababbabbabaaccaacccaccbcbbacabccacaacbabcaabccbabbbcacabcbacbbcabbcaccccbacbbbbbbabaaacbbbacabccb

Output: 20771310

Input:
127
aabababaaaabacaababbbabcbaabbccbaabaabbacbcacacaaaabcbabcbcacbbaacbcbbaaaaaaacaccbbccabcbbbaaabaabbbbbbcbcbbbbbabaaaaaacaabacbb

Output: 9367475

Input:
138
cbcccbcbccccccccbabccacacacacaccccbccccaccaabaacbcbaabbcaaccabcacbbbbaabbcbacbbcbabccacacccabcccacaacaacababbcbbcacaccccccccbacacccccbcabb

Output: 16096450

Input:
143
caaaaccccacacaaacaaaacabbabcabbccaccbcaaacaccbcaaccabaccabbacabacaaccccbaacccaacbccaacabcbaaccaaccacaaaacaaccccccccacaacbcbcabcaccaaccccaaaacaa

Output: 27778715

Input:
149
cabbacccabbacaaaccbcabababbbaabaaccacabbaaaccacabaabbcbacccbbbbccabccccccbbbbababcccbbbbaccbaabbacccababcbabacabcaacabaacacbcacbbccbaacbaacbbbbccbbbb

Output: 10269731

Input:
150
cbcbbcbcbbbbcbbccbbcbabaababcbbbbbcbcbbabbcbabbabcaabccabaabccbacacaacbbbbcbaababccbbabbabbbbbccbcbabbaacbcbbababbaabbbbbbbbacbbaabcabbbcaacbcbbbacbca

Output: 12880152

Input:
150
baccbacbabcccbbcbabbabbcaabaabcbbbbcbcabacccabbaababbcabbbaccbbbbabcbaacbcacaabbbcccacbcbabaaabbbcbabbcccababbbbbacaccabccaabaabbcaababbcaacbacbabbbba

Output: 42572453

Input:
150
cbacaabacbbbabcbccacacaacbccbabacbbcbcacbbcacbcaaaabcacacabbaacaaacccbccbcaabaaaabbccccaccbabaccabbccccbbacbaaaaaccbbbccbabbbaacacccabbacacbbcccbccbcb

Output: 15908925

Input:
150
abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc

Output: 36993465

Input:
150
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Output: 0

Input:
150
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaa

Output: 0

Input:
150
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab

Output: 2601

Input:
150
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

Output: 0

Input:
150
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccc

Output: 1

Input:
1
a

Output: 1

Input:
1
b

Output: 1