#include <bits/stdc++.h>
using namespace std;
const long long mod = 777777777;
const int N = 270;
long long f[N][N][N];
int main() {
  f[1][1][0] = 1;
  f[1][1][1] = 0;
  f[2][2][0] = 1;
  f[2][2][1] = 2;
  f[2][2][2] = 1;
  f[4][4][0] = 5;
  f[4][4][1] = 32;
  f[4][4][2] = 30;
  f[4][4][3] = 80;
  f[4][4][4] = 109;
  f[8][8][0] = 541;
  f[8][8][1] = 6824;
  f[8][8][2] = 59808;
  f[8][8][3] = 147224;
  f[8][8][4] = 415870;
  f[8][8][5] = 1757896;
  f[8][8][6] = 1897056;
  f[8][8][7] = 4898872;
  f[8][8][8] = 7593125;
  f[16][16][0] = 166257661;
  f[16][16][1] = 776830421;
  f[16][16][2] = 290516100;
  f[16][16][3] = 746623577;
  f[16][16][4] = 293783147;
  f[16][16][5] = 33900006;
  f[16][16][6] = 735127505;
  f[16][16][7] = 565460332;
  f[16][16][8] = 428982705;
  f[16][16][9] = 472062098;
  f[16][16][10] = 161873957;
  f[16][16][11] = 117354594;
  f[16][16][12] = 515619293;
  f[16][16][13] = 578944191;
  f[16][16][14] = 312106242;
  f[16][16][15] = 569389279;
  f[16][16][16] = 391464593;
  f[32][32][0] = 464207287;
  f[32][32][1] = 261086313;
  f[32][32][2] = 584837659;
  f[32][32][3] = 683961846;
  f[32][32][4] = 468868529;
  f[32][32][5] = 211593382;
  f[32][32][6] = 736955478;
  f[32][32][7] = 229471758;
  f[32][32][8] = 157617135;
  f[32][32][9] = 398169441;
  f[32][32][10] = 360252438;
  f[32][32][11] = 629394768;
  f[32][32][12] = 264125799;
  f[32][32][13] = 647490480;
  f[32][32][14] = 342079395;
  f[32][32][15] = 391579767;
  f[32][32][16] = 225200475;
  f[32][32][17] = 486011304;
  f[32][32][18] = 513156108;
  f[32][32][19] = 628771752;
  f[32][32][20] = 132906648;
  f[32][32][21] = 142138221;
  f[32][32][22] = 20119449;
  f[32][32][23] = 444199674;
  f[32][32][24] = 195188679;
  f[32][32][25] = 387329805;
  f[32][32][26] = 44684703;
  f[32][32][27] = 651912135;
  f[32][32][28] = 737154512;
  f[32][32][29] = 612549793;
  f[32][32][30] = 519860281;
  f[32][32][31] = 186175544;
  f[32][32][32] = 212568440;
  f[64][64][0] = 382725349;
  f[64][64][1] = 240805271;
  f[64][64][2] = 239509872;
  f[64][64][3] = 581127897;
  f[64][64][4] = 6511239;
  f[64][64][5] = 156126222;
  f[64][64][6] = 509425833;
  f[64][64][7] = 672407328;
  f[64][64][8] = 366667722;
  f[64][64][9] = 459185405;
  f[64][64][10] = 509737025;
  f[64][64][11] = 554790222;
  f[64][64][12] = 165216555;
  f[64][64][13] = 703150560;
  f[64][64][14] = 74806569;
  f[64][64][15] = 398730015;
  f[64][64][16] = 383350905;
  f[64][64][17] = 506108358;
  f[64][64][18] = 51326142;
  f[64][64][19] = 298053147;
  f[64][64][20] = 104256117;
  f[64][64][21] = 391428765;
  f[64][64][22] = 374020479;
  f[64][64][23] = 206607807;
  f[64][64][24] = 87664059;
  f[64][64][25] = 275899176;
  f[64][64][26] = 56407680;
  f[64][64][27] = 551553401;
  f[64][64][28] = 448939463;
  f[64][64][29] = 582889860;
  f[64][64][30] = 129676638;
  f[64][64][31] = 226078251;
  f[64][64][32] = 135769095;
  f[64][64][33] = 61292868;
  f[64][64][34] = 578972226;
  f[64][64][35] = 190181628;
  f[64][64][36] = 390739055;
  f[64][64][37] = 184587732;
  f[64][64][38] = 446575689;
  f[64][64][39] = 732674124;
  f[64][64][40] = 232198470;
  f[64][64][41] = 676760679;
  f[64][64][42] = 352474101;
  f[64][64][43] = 611444862;
  f[64][64][44] = 575661807;
  f[64][64][45] = 628905585;
  f[64][64][46] = 320813094;
  f[64][64][47] = 522840969;
  f[64][64][48] = 469781928;
  f[64][64][49] = 156006018;
  f[64][64][50] = 554473341;
  f[64][64][51] = 239654268;
  f[64][64][52] = 643714911;
  f[64][64][53] = 433540170;
  f[64][64][54] = 199307003;
  f[64][64][55] = 496385218;
  f[64][64][56] = 291740751;
  f[64][64][57] = 67309914;
  f[64][64][58] = 370826673;
  f[64][64][59] = 202356819;
  f[64][64][60] = 279421821;
  f[64][64][61] = 421203111;
  f[64][64][62] = 63744786;
  f[64][64][63] = 520987612;
  f[64][64][64] = 550671827;
  f[128][128][0] = 642497124;
  f[128][128][1] = 482164403;
  f[128][128][2] = 768209115;
  f[128][128][3] = 462063756;
  f[128][128][4] = 154906374;
  f[128][128][5] = 36099042;
  f[128][128][6] = 341766705;
  f[128][128][7] = 678182556;
  f[128][128][8] = 621882744;
  f[128][128][9] = 478771358;
  f[128][128][10] = 231881111;
  f[128][128][11] = 175889805;
  f[128][128][12] = 243630450;
  f[128][128][13] = 168908523;
  f[128][128][14] = 671961765;
  f[128][128][15] = 55761813;
  f[128][128][16] = 652682670;
  f[128][128][17] = 773939082;
  f[128][128][18] = 517628076;
  f[128][128][19] = 756201264;
  f[128][128][20] = 124604900;
  f[128][128][21] = 750976272;
  f[128][128][22] = 498253248;
  f[128][128][23] = 676047609;
  f[128][128][24] = 137170026;
  f[128][128][25] = 705610017;
  f[128][128][26] = 495032139;
  f[128][128][27] = 561797418;
  f[128][128][28] = 703097347;
  f[128][128][29] = 500815609;
  f[128][128][30] = 95984586;
  f[128][128][31] = 739707108;
  f[128][128][32] = 265613565;
  f[128][128][33] = 387099846;
  f[128][128][34] = 777331779;
  f[128][128][35] = 594676173;
  f[128][128][36] = 591219559;
  f[128][128][37] = 407997044;
  f[128][128][38] = 208947235;
  f[128][128][39] = 93337440;
  f[128][128][40] = 478908360;
  f[128][128][41] = 685013007;
  f[128][128][42] = 487033953;
  f[128][128][43] = 671903001;
  f[128][128][44] = 39521181;
  f[128][128][45] = 738490312;
  f[128][128][46] = 33785059;
  f[128][128][47] = 465470131;
  f[128][128][48] = 310453920;
  f[128][128][49] = 54648783;
  f[128][128][50] = 346831137;
  f[128][128][51] = 427694175;
  f[128][128][52] = 474743430;
  f[128][128][53] = 705296781;
  f[128][128][54] = 435828036;
  f[128][128][55] = 429824745;
  f[128][128][56] = 663532359;
  f[128][128][57] = 261388683;
  f[128][128][58] = 244690731;
  f[128][128][59] = 533997135;
  f[128][128][60] = 596108961;
  f[128][128][61] = 506813013;
  f[128][128][62] = 371892402;
  f[128][128][63] = 590145264;
  f[128][128][64] = 104733162;
  f[128][128][65] = 143420103;
  f[128][128][66] = 654339672;
  f[128][128][67] = 700348950;
  f[128][128][68] = 685038942;
  f[128][128][69] = 578826927;
  f[128][128][70] = 286484229;
  f[128][128][71] = 501639192;
  f[128][128][72] = 434962491;
  f[128][128][73] = 299270097;
  f[128][128][74] = 27702486;
  f[128][128][75] = 335375775;
  f[128][128][76] = 111746817;
  f[128][128][77] = 565603164;
  f[128][128][78] = 294926121;
  f[128][128][79] = 676063665;
  f[128][128][80] = 735862995;
  f[128][128][81] = 710035809;
  f[128][128][82] = 437011960;
  f[128][128][83] = 668528077;
  f[128][128][84] = 138765186;
  f[128][128][85] = 508213986;
  f[128][128][86] = 615036450;
  f[128][128][87] = 353784942;
  f[128][128][88] = 624827616;
  f[128][128][89] = 343900011;
  f[128][128][90] = 241289776;
  f[128][128][91] = 52410890;
  f[128][128][92] = 72018835;
  f[128][128][93] = 352406796;
  f[128][128][94] = 415705878;
  f[128][128][95] = 4802637;
  f[128][128][96] = 376367145;
  f[128][128][97] = 65589678;
  f[128][128][98] = 333633477;
  f[128][128][99] = 341834527;
  f[128][128][100] = 303717460;
  f[128][128][101] = 282387700;
  f[128][128][102] = 42951006;
  f[128][128][103] = 254706039;
  f[128][128][104] = 423048528;
  f[128][128][105] = 526429710;
  f[128][128][106] = 68131467;
  f[128][128][107] = 669954708;
  f[128][128][108] = 12787348;
  f[128][128][109] = 500636381;
  f[128][128][110] = 317959019;
  f[128][128][111] = 479433192;
  f[128][128][112] = 657133515;
  f[128][128][113] = 416259390;
  f[128][128][114] = 610216692;
  f[128][128][115] = 340129188;
  f[128][128][116] = 44594256;
  f[128][128][117] = 257373347;
  f[128][128][118] = 138718678;
  f[128][128][119] = 530767740;
  f[128][128][120] = 292922628;
  f[128][128][121] = 37220268;
  f[128][128][122] = 605295159;
  f[128][128][123] = 480722613;
  f[128][128][124] = 458170419;
  f[128][128][125] = 30540300;
  f[128][128][126] = 487159055;
  f[128][128][127] = 232966794;
  f[128][128][128] = 149150650;
  f[256][256][0] = 507720408;
  f[256][256][1] = 412133651;
  f[256][256][2] = 386543325;
  f[256][256][3] = 139952108;
  f[256][256][4] = 289303402;
  f[256][256][5] = 102404925;
  f[256][256][6] = 317067177;
  f[256][256][7] = 396414708;
  f[256][256][8] = 80515854;
  f[256][256][9] = 663739304;
  f[256][256][10] = 317300809;
  f[256][256][11] = 228877044;
  f[256][256][12] = 493725043;
  f[256][256][13] = 715317967;
  f[256][256][14] = 490300965;
  f[256][256][15] = 315527373;
  f[256][256][16] = 743539734;
  f[256][256][17] = 488329191;
  f[256][256][18] = 553627998;
  f[256][256][19] = 533025234;
  f[256][256][20] = 242583957;
  f[256][256][21] = 706116537;
  f[256][256][22] = 614109258;
  f[256][256][23] = 645447222;
  f[256][256][24] = 523195911;
  f[256][256][25] = 492109128;
  f[256][256][26] = 722623041;
  f[256][256][27] = 111085128;
  f[256][256][28] = 766395126;
  f[256][256][29] = 654378921;
  f[256][256][30] = 691964847;
  f[256][256][31] = 496688157;
  f[256][256][32] = 399056049;
  f[256][256][33] = 654363234;
  f[256][256][34] = 102052314;
  f[256][256][35] = 191720088;
  f[256][256][36] = 473910948;
  f[256][256][37] = 259736526;
  f[256][256][38] = 332840025;
  f[256][256][39] = 388047555;
  f[256][256][40] = 665791056;
  f[256][256][41] = 627111387;
  f[256][256][42] = 139696515;
  f[256][256][43] = 441456687;
  f[256][256][44] = 443032569;
  f[256][256][45] = 283264821;
  f[256][256][46] = 771641703;
  f[256][256][47] = 452641455;
  f[256][256][48] = 511306362;
  f[256][256][49] = 117572859;
  f[256][256][50] = 127701891;
  f[256][256][51] = 721298331;
  f[256][256][52] = 176520078;
  f[256][256][53] = 357242229;
  f[256][256][54] = 611296308;
  f[256][256][55] = 696994956;
  f[256][256][56] = 405628839;
  f[256][256][57] = 429224274;
  f[256][256][58] = 465336054;
  f[256][256][59] = 695091546;
  f[256][256][60] = 689828796;
  f[256][256][61] = 574648641;
  f[256][256][62] = 351220905;
  f[256][256][63] = 507964023;
  f[256][256][64] = 675326610;
  f[256][256][65] = 517248963;
  f[256][256][66] = 453528621;
  f[256][256][67] = 220301928;
  f[256][256][68] = 494463186;
  f[256][256][69] = 681789969;
  f[256][256][70] = 339589656;
  f[256][256][71] = 44524053;
  f[256][256][72] = 417125457;
  f[256][256][73] = 339589404;
  f[256][256][74] = 747135963;
  f[256][256][75] = 341780733;
  f[256][256][76] = 734158215;
  f[256][256][77] = 396817281;
  f[256][256][78] = 21997836;
  f[256][256][79] = 5728464;
  f[256][256][80] = 147611205;
  f[256][256][81] = 456248898;
  f[256][256][82] = 714128667;
  f[256][256][83] = 377654949;
  f[256][256][84] = 3862068;
  f[256][256][85] = 128418948;
  f[256][256][86] = 589390074;
  f[256][256][87] = 304947090;
  f[256][256][88] = 11703825;
  f[256][256][89] = 228266073;
  f[256][256][90] = 127304142;
  f[256][256][91] = 429215724;
  f[256][256][92] = 361541124;
  f[256][256][93] = 521572968;
  f[256][256][94] = 468358191;
  f[256][256][95] = 341231688;
  f[256][256][96] = 65323503;
  f[256][256][97] = 613778508;
  f[256][256][98] = 15985323;
  f[256][256][99] = 291661029;
  f[256][256][100] = 410970006;
  f[256][256][101] = 591638112;
  f[256][256][102] = 349541550;
  f[256][256][103] = 89967528;
  f[256][256][104] = 224922159;
  f[256][256][105] = 361094166;
  f[256][256][106] = 584206074;
  f[256][256][107] = 640051812;
  f[256][256][108] = 324264456;
  f[256][256][109] = 652625388;
  f[256][256][110] = 693768537;
  f[256][256][111] = 11740617;
  f[256][256][112] = 309238398;
  f[256][256][113] = 211085469;
  f[256][256][114] = 194905872;
  f[256][256][115] = 639416484;
  f[256][256][116] = 110110707;
  f[256][256][117] = 296645895;
  f[256][256][118] = 748118511;
  f[256][256][119] = 131177718;
  f[256][256][120] = 511142751;
  f[256][256][121] = 775975599;
  f[256][256][122] = 421403409;
  f[256][256][123] = 475528473;
  f[256][256][124] = 434685258;
  f[256][256][125] = 1768977;
  f[256][256][126] = 80301375;
  f[256][256][127] = 708023862;
  f[256][256][128] = 569195676;
  f[256][256][129] = 56238084;
  f[256][256][130] = 632887668;
  f[256][256][131] = 88089750;
  f[256][256][132] = 631539342;
  f[256][256][133] = 396695565;
  f[256][256][134] = 38780154;
  f[256][256][135] = 695798271;
  f[256][256][136] = 469819224;
  f[256][256][137] = 439587099;
  f[256][256][138] = 69045921;
  f[256][256][139] = 682966116;
  f[256][256][140] = 112310856;
  f[256][256][141] = 64943298;
  f[256][256][142] = 534475872;
  f[256][256][143] = 40215357;
  f[256][256][144] = 389728458;
  f[256][256][145] = 286368453;
  f[256][256][146] = 736006257;
  f[256][256][147] = 501181650;
  f[256][256][148] = 54829908;
  f[256][256][149] = 603489402;
  f[256][256][150] = 338032656;
  f[256][256][151] = 512182818;
  f[256][256][152] = 627500097;
  f[256][256][153] = 462674016;
  f[256][256][154] = 3103092;
  f[256][256][155] = 157324491;
  f[256][256][156] = 43978329;
  f[256][256][157] = 596818971;
  f[256][256][158] = 259025598;
  f[256][256][159] = 9088632;
  f[256][256][160] = 91991781;
  f[256][256][161] = 577291428;
  f[256][256][162] = 211245489;
  f[256][256][163] = 429471231;
  f[256][256][164] = 142626330;
  f[256][256][165] = 172560633;
  f[256][256][166] = 510907446;
  f[256][256][167] = 444609585;
  f[256][256][168] = 758102058;
  f[256][256][169] = 375112647;
  f[256][256][170] = 744786693;
  f[256][256][171] = 276174402;
  f[256][256][172] = 19259856;
  f[256][256][173] = 233672418;
  f[256][256][174] = 745389414;
  f[256][256][175] = 225772848;
  f[256][256][176] = 23385663;
  f[256][256][177] = 324290610;
  f[256][256][178] = 519804558;
  f[256][256][179] = 120337812;
  f[256][256][180] = 402578568;
  f[256][256][181] = 360676008;
  f[256][256][182] = 450089262;
  f[256][256][183] = 551043738;
  f[256][256][184] = 337388940;
  f[256][256][185] = 512108856;
  f[256][256][186] = 28879011;
  f[256][256][187] = 690040638;
  f[256][256][188] = 106017282;
  f[256][256][189] = 558262341;
  f[256][256][190] = 99972432;
  f[256][256][191] = 608226003;
  f[256][256][192] = 612152037;
  f[256][256][193] = 42414435;
  f[256][256][194] = 776201013;
  f[256][256][195] = 39580443;
  f[256][256][196] = 518796945;
  f[256][256][197] = 494437752;
  f[256][256][198] = 583194366;
  f[256][256][199] = 723936555;
  f[256][256][200] = 415359657;
  f[256][256][201] = 309569589;
  f[256][256][202] = 751104774;
  f[256][256][203] = 166684527;
  f[256][256][204] = 249229170;
  f[256][256][205] = 353120823;
  f[256][256][206] = 130668327;
  f[256][256][207] = 753823584;
  f[256][256][208] = 580966092;
  f[256][256][209] = 561963717;
  f[256][256][210] = 543672234;
  f[256][256][211] = 393846327;
  f[256][256][212] = 586278000;
  f[256][256][213] = 327398400;
  f[256][256][214] = 278403867;
  f[256][256][215] = 156455586;
  f[256][256][216] = 363920382;
  f[256][256][217] = 190245195;
  f[256][256][218] = 290039148;
  f[256][256][219] = 547014447;
  f[256][256][220] = 466218648;
  f[256][256][221] = 146037150;
  f[256][256][222] = 585462906;
  f[256][256][223] = 666008595;
  f[256][256][224] = 691786683;
  f[256][256][225] = 374707494;
  f[256][256][226] = 622498779;
  f[256][256][227] = 231158277;
  f[256][256][228] = 685740951;
  f[256][256][229] = 115612245;
  f[256][256][230] = 681825249;
  f[256][256][231] = 545555745;
  f[256][256][232] = 551718468;
  f[256][256][233] = 277206615;
  f[256][256][234] = 640171035;
  f[256][256][235] = 757727334;
  f[256][256][236] = 195193908;
  f[256][256][237] = 658656684;
  f[256][256][238] = 457760646;
  f[256][256][239] = 225925875;
  f[256][256][240] = 505761984;
  f[256][256][241] = 18685233;
  f[256][256][242] = 506832921;
  f[256][256][243] = 112511021;
  f[256][256][244] = 396846646;
  f[256][256][245] = 290147622;
  f[256][256][246] = 113924623;
  f[256][256][247] = 669986155;
  f[256][256][248] = 336008070;
  f[256][256][249] = 63611061;
  f[256][256][250] = 238586775;
  f[256][256][251] = 119956662;
  f[256][256][252] = 616557739;
  f[256][256][253] = 772784623;
  f[256][256][254] = 334527774;
  f[256][256][255] = 410403148;
  f[256][256][256] = 51933421;
  int n, k;
  scanf("%d %d", &n, &k);
  printf("%lld\n", f[n][n][k]);
  return 0;
}

### Prompt

Please provide a cpp coded solution to the problem described below:

There are n people, sitting in a line at the table. For each person we know that he always tells either the truth or lies.

Little Serge asked them: how many of you always tell the truth? Each of the people at the table knows everything (who is an honest person and who is a liar) about all the people at the table. The honest people are going to say the correct answer, the liars are going to say any integer from 1 to n, which is not the correct answer. Every liar chooses his answer, regardless of the other liars, so two distinct liars may give distinct answer.

Serge does not know any information about the people besides their answers to his question. He took a piece of paper and wrote n integers a1, a2, ..., an, where ai is the answer of the i-th person in the row. Given this sequence, Serge determined that exactly k people sitting at the table apparently lie.

Serge wonders, how many variants of people's answers (sequences of answers a of length n) there are where one can say that exactly k people sitting at the table apparently lie. As there can be rather many described variants of answers, count the remainder of dividing the number of the variants by 777777777.

Input

The first line contains two integers n, k, (1 ≤ k ≤ n ≤ 28). It is guaranteed that n — is the power of number 2.

Output

Print a single integer — the answer to the problem modulo 777777777.

Examples

Input

1 1


Output

0


Input

2 1


Output

2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long mod = 777777777;
const int N = 270;
long long f[N][N][N];
int main() {
  f[1][1][0] = 1;
  f[1][1][1] = 0;
  f[2][2][0] = 1;
  f[2][2][1] = 2;
  f[2][2][2] = 1;
  f[4][4][0] = 5;
  f[4][4][1] = 32;
  f[4][4][2] = 30;
  f[4][4][3] = 80;
  f[4][4][4] = 109;
  f[8][8][0] = 541;
  f[8][8][1] = 6824;
  f[8][8][2] = 59808;
  f[8][8][3] = 147224;
  f[8][8][4] = 415870;
  f[8][8][5] = 1757896;
  f[8][8][6] = 1897056;
  f[8][8][7] = 4898872;
  f[8][8][8] = 7593125;
  f[16][16][0] = 166257661;
  f[16][16][1] = 776830421;
  f[16][16][2] = 290516100;
  f[16][16][3] = 746623577;
  f[16][16][4] = 293783147;
  f[16][16][5] = 33900006;
  f[16][16][6] = 735127505;
  f[16][16][7] = 565460332;
  f[16][16][8] = 428982705;
  f[16][16][9] = 472062098;
  f[16][16][10] = 161873957;
  f[16][16][11] = 117354594;
  f[16][16][12] = 515619293;
  f[16][16][13] = 578944191;
  f[16][16][14] = 312106242;
  f[16][16][15] = 569389279;
  f[16][16][16] = 391464593;
  f[32][32][0] = 464207287;
  f[32][32][1] = 261086313;
  f[32][32][2] = 584837659;
  f[32][32][3] = 683961846;
  f[32][32][4] = 468868529;
  f[32][32][5] = 211593382;
  f[32][32][6] = 736955478;
  f[32][32][7] = 229471758;
  f[32][32][8] = 157617135;
  f[32][32][9] = 398169441;
  f[32][32][10] = 360252438;
  f[32][32][11] = 629394768;
  f[32][32][12] = 264125799;
  f[32][32][13] = 647490480;
  f[32][32][14] = 342079395;
  f[32][32][15] = 391579767;
  f[32][32][16] = 225200475;
  f[32][32][17] = 486011304;
  f[32][32][18] = 513156108;
  f[32][32][19] = 628771752;
  f[32][32][20] = 132906648;
  f[32][32][21] = 142138221;
  f[32][32][22] = 20119449;
  f[32][32][23] = 444199674;
  f[32][32][24] = 195188679;
  f[32][32][25] = 387329805;
  f[32][32][26] = 44684703;
  f[32][32][27] = 651912135;
  f[32][32][28] = 737154512;
  f[32][32][29] = 612549793;
  f[32][32][30] = 519860281;
  f[32][32][31] = 186175544;
  f[32][32][32] = 212568440;
  f[64][64][0] = 382725349;
  f[64][64][1] = 240805271;
  f[64][64][2] = 239509872;
  f[64][64][3] = 581127897;
  f[64][64][4] = 6511239;
  f[64][64][5] = 156126222;
  f[64][64][6] = 509425833;
  f[64][64][7] = 672407328;
  f[64][64][8] = 366667722;
  f[64][64][9] = 459185405;
  f[64][64][10] = 509737025;
  f[64][64][11] = 554790222;
  f[64][64][12] = 165216555;
  f[64][64][13] = 703150560;
  f[64][64][14] = 74806569;
  f[64][64][15] = 398730015;
  f[64][64][16] = 383350905;
  f[64][64][17] = 506108358;
  f[64][64][18] = 51326142;
  f[64][64][19] = 298053147;
  f[64][64][20] = 104256117;
  f[64][64][21] = 391428765;
  f[64][64][22] = 374020479;
  f[64][64][23] = 206607807;
  f[64][64][24] = 87664059;
  f[64][64][25] = 275899176;
  f[64][64][26] = 56407680;
  f[64][64][27] = 551553401;
  f[64][64][28] = 448939463;
  f[64][64][29] = 582889860;
  f[64][64][30] = 129676638;
  f[64][64][31] = 226078251;
  f[64][64][32] = 135769095;
  f[64][64][33] = 61292868;
  f[64][64][34] = 578972226;
  f[64][64][35] = 190181628;
  f[64][64][36] = 390739055;
  f[64][64][37] = 184587732;
  f[64][64][38] = 446575689;
  f[64][64][39] = 732674124;
  f[64][64][40] = 232198470;
  f[64][64][41] = 676760679;
  f[64][64][42] = 352474101;
  f[64][64][43] = 611444862;
  f[64][64][44] = 575661807;
  f[64][64][45] = 628905585;
  f[64][64][46] = 320813094;
  f[64][64][47] = 522840969;
  f[64][64][48] = 469781928;
  f[64][64][49] = 156006018;
  f[64][64][50] = 554473341;
  f[64][64][51] = 239654268;
  f[64][64][52] = 643714911;
  f[64][64][53] = 433540170;
  f[64][64][54] = 199307003;
  f[64][64][55] = 496385218;
  f[64][64][56] = 291740751;
  f[64][64][57] = 67309914;
  f[64][64][58] = 370826673;
  f[64][64][59] = 202356819;
  f[64][64][60] = 279421821;
  f[64][64][61] = 421203111;
  f[64][64][62] = 63744786;
  f[64][64][63] = 520987612;
  f[64][64][64] = 550671827;
  f[128][128][0] = 642497124;
  f[128][128][1] = 482164403;
  f[128][128][2] = 768209115;
  f[128][128][3] = 462063756;
  f[128][128][4] = 154906374;
  f[128][128][5] = 36099042;
  f[128][128][6] = 341766705;
  f[128][128][7] = 678182556;
  f[128][128][8] = 621882744;
  f[128][128][9] = 478771358;
  f[128][128][10] = 231881111;
  f[128][128][11] = 175889805;
  f[128][128][12] = 243630450;
  f[128][128][13] = 168908523;
  f[128][128][14] = 671961765;
  f[128][128][15] = 55761813;
  f[128][128][16] = 652682670;
  f[128][128][17] = 773939082;
  f[128][128][18] = 517628076;
  f[128][128][19] = 756201264;
  f[128][128][20] = 124604900;
  f[128][128][21] = 750976272;
  f[128][128][22] = 498253248;
  f[128][128][23] = 676047609;
  f[128][128][24] = 137170026;
  f[128][128][25] = 705610017;
  f[128][128][26] = 495032139;
  f[128][128][27] = 561797418;
  f[128][128][28] = 703097347;
  f[128][128][29] = 500815609;
  f[128][128][30] = 95984586;
  f[128][128][31] = 739707108;
  f[128][128][32] = 265613565;
  f[128][128][33] = 387099846;
  f[128][128][34] = 777331779;
  f[128][128][35] = 594676173;
  f[128][128][36] = 591219559;
  f[128][128][37] = 407997044;
  f[128][128][38] = 208947235;
  f[128][128][39] = 93337440;
  f[128][128][40] = 478908360;
  f[128][128][41] = 685013007;
  f[128][128][42] = 487033953;
  f[128][128][43] = 671903001;
  f[128][128][44] = 39521181;
  f[128][128][45] = 738490312;
  f[128][128][46] = 33785059;
  f[128][128][47] = 465470131;
  f[128][128][48] = 310453920;
  f[128][128][49] = 54648783;
  f[128][128][50] = 346831137;
  f[128][128][51] = 427694175;
  f[128][128][52] = 474743430;
  f[128][128][53] = 705296781;
  f[128][128][54] = 435828036;
  f[128][128][55] = 429824745;
  f[128][128][56] = 663532359;
  f[128][128][57] = 261388683;
  f[128][128][58] = 244690731;
  f[128][128][59] = 533997135;
  f[128][128][60] = 596108961;
  f[128][128][61] = 506813013;
  f[128][128][62] = 371892402;
  f[128][128][63] = 590145264;
  f[128][128][64] = 104733162;
  f[128][128][65] = 143420103;
  f[128][128][66] = 654339672;
  f[128][128][67] = 700348950;
  f[128][128][68] = 685038942;
  f[128][128][69] = 578826927;
  f[128][128][70] = 286484229;
  f[128][128][71] = 501639192;
  f[128][128][72] = 434962491;
  f[128][128][73] = 299270097;
  f[128][128][74] = 27702486;
  f[128][128][75] = 335375775;
  f[128][128][76] = 111746817;
  f[128][128][77] = 565603164;
  f[128][128][78] = 294926121;
  f[128][128][79] = 676063665;
  f[128][128][80] = 735862995;
  f[128][128][81] = 710035809;
  f[128][128][82] = 437011960;
  f[128][128][83] = 668528077;
  f[128][128][84] = 138765186;
  f[128][128][85] = 508213986;
  f[128][128][86] = 615036450;
  f[128][128][87] = 353784942;
  f[128][128][88] = 624827616;
  f[128][128][89] = 343900011;
  f[128][128][90] = 241289776;
  f[128][128][91] = 52410890;
  f[128][128][92] = 72018835;
  f[128][128][93] = 352406796;
  f[128][128][94] = 415705878;
  f[128][128][95] = 4802637;
  f[128][128][96] = 376367145;
  f[128][128][97] = 65589678;
  f[128][128][98] = 333633477;
  f[128][128][99] = 341834527;
  f[128][128][100] = 303717460;
  f[128][128][101] = 282387700;
  f[128][128][102] = 42951006;
  f[128][128][103] = 254706039;
  f[128][128][104] = 423048528;
  f[128][128][105] = 526429710;
  f[128][128][106] = 68131467;
  f[128][128][107] = 669954708;
  f[128][128][108] = 12787348;
  f[128][128][109] = 500636381;
  f[128][128][110] = 317959019;
  f[128][128][111] = 479433192;
  f[128][128][112] = 657133515;
  f[128][128][113] = 416259390;
  f[128][128][114] = 610216692;
  f[128][128][115] = 340129188;
  f[128][128][116] = 44594256;
  f[128][128][117] = 257373347;
  f[128][128][118] = 138718678;
  f[128][128][119] = 530767740;
  f[128][128][120] = 292922628;
  f[128][128][121] = 37220268;
  f[128][128][122] = 605295159;
  f[128][128][123] = 480722613;
  f[128][128][124] = 458170419;
  f[128][128][125] = 30540300;
  f[128][128][126] = 487159055;
  f[128][128][127] = 232966794;
  f[128][128][128] = 149150650;
  f[256][256][0] = 507720408;
  f[256][256][1] = 412133651;
  f[256][256][2] = 386543325;
  f[256][256][3] = 139952108;
  f[256][256][4] = 289303402;
  f[256][256][5] = 102404925;
  f[256][256][6] = 317067177;
  f[256][256][7] = 396414708;
  f[256][256][8] = 80515854;
  f[256][256][9] = 663739304;
  f[256][256][10] = 317300809;
  f[256][256][11] = 228877044;
  f[256][256][12] = 493725043;
  f[256][256][13] = 715317967;
  f[256][256][14] = 490300965;
  f[256][256][15] = 315527373;
  f[256][256][16] = 743539734;
  f[256][256][17] = 488329191;
  f[256][256][18] = 553627998;
  f[256][256][19] = 533025234;
  f[256][256][20] = 242583957;
  f[256][256][21] = 706116537;
  f[256][256][22] = 614109258;
  f[256][256][23] = 645447222;
  f[256][256][24] = 523195911;
  f[256][256][25] = 492109128;
  f[256][256][26] = 722623041;
  f[256][256][27] = 111085128;
  f[256][256][28] = 766395126;
  f[256][256][29] = 654378921;
  f[256][256][30] = 691964847;
  f[256][256][31] = 496688157;
  f[256][256][32] = 399056049;
  f[256][256][33] = 654363234;
  f[256][256][34] = 102052314;
  f[256][256][35] = 191720088;
  f[256][256][36] = 473910948;
  f[256][256][37] = 259736526;
  f[256][256][38] = 332840025;
  f[256][256][39] = 388047555;
  f[256][256][40] = 665791056;
  f[256][256][41] = 627111387;
  f[256][256][42] = 139696515;
  f[256][256][43] = 441456687;
  f[256][256][44] = 443032569;
  f[256][256][45] = 283264821;
  f[256][256][46] = 771641703;
  f[256][256][47] = 452641455;
  f[256][256][48] = 511306362;
  f[256][256][49] = 117572859;
  f[256][256][50] = 127701891;
  f[256][256][51] = 721298331;
  f[256][256][52] = 176520078;
  f[256][256][53] = 357242229;
  f[256][256][54] = 611296308;
  f[256][256][55] = 696994956;
  f[256][256][56] = 405628839;
  f[256][256][57] = 429224274;
  f[256][256][58] = 465336054;
  f[256][256][59] = 695091546;
  f[256][256][60] = 689828796;
  f[256][256][61] = 574648641;
  f[256][256][62] = 351220905;
  f[256][256][63] = 507964023;
  f[256][256][64] = 675326610;
  f[256][256][65] = 517248963;
  f[256][256][66] = 453528621;
  f[256][256][67] = 220301928;
  f[256][256][68] = 494463186;
  f[256][256][69] = 681789969;
  f[256][256][70] = 339589656;
  f[256][256][71] = 44524053;
  f[256][256][72] = 417125457;
  f[256][256][73] = 339589404;
  f[256][256][74] = 747135963;
  f[256][256][75] = 341780733;
  f[256][256][76] = 734158215;
  f[256][256][77] = 396817281;
  f[256][256][78] = 21997836;
  f[256][256][79] = 5728464;
  f[256][256][80] = 147611205;
  f[256][256][81] = 456248898;
  f[256][256][82] = 714128667;
  f[256][256][83] = 377654949;
  f[256][256][84] = 3862068;
  f[256][256][85] = 128418948;
  f[256][256][86] = 589390074;
  f[256][256][87] = 304947090;
  f[256][256][88] = 11703825;
  f[256][256][89] = 228266073;
  f[256][256][90] = 127304142;
  f[256][256][91] = 429215724;
  f[256][256][92] = 361541124;
  f[256][256][93] = 521572968;
  f[256][256][94] = 468358191;
  f[256][256][95] = 341231688;
  f[256][256][96] = 65323503;
  f[256][256][97] = 613778508;
  f[256][256][98] = 15985323;
  f[256][256][99] = 291661029;
  f[256][256][100] = 410970006;
  f[256][256][101] = 591638112;
  f[256][256][102] = 349541550;
  f[256][256][103] = 89967528;
  f[256][256][104] = 224922159;
  f[256][256][105] = 361094166;
  f[256][256][106] = 584206074;
  f[256][256][107] = 640051812;
  f[256][256][108] = 324264456;
  f[256][256][109] = 652625388;
  f[256][256][110] = 693768537;
  f[256][256][111] = 11740617;
  f[256][256][112] = 309238398;
  f[256][256][113] = 211085469;
  f[256][256][114] = 194905872;
  f[256][256][115] = 639416484;
  f[256][256][116] = 110110707;
  f[256][256][117] = 296645895;
  f[256][256][118] = 748118511;
  f[256][256][119] = 131177718;
  f[256][256][120] = 511142751;
  f[256][256][121] = 775975599;
  f[256][256][122] = 421403409;
  f[256][256][123] = 475528473;
  f[256][256][124] = 434685258;
  f[256][256][125] = 1768977;
  f[256][256][126] = 80301375;
  f[256][256][127] = 708023862;
  f[256][256][128] = 569195676;
  f[256][256][129] = 56238084;
  f[256][256][130] = 632887668;
  f[256][256][131] = 88089750;
  f[256][256][132] = 631539342;
  f[256][256][133] = 396695565;
  f[256][256][134] = 38780154;
  f[256][256][135] = 695798271;
  f[256][256][136] = 469819224;
  f[256][256][137] = 439587099;
  f[256][256][138] = 69045921;
  f[256][256][139] = 682966116;
  f[256][256][140] = 112310856;
  f[256][256][141] = 64943298;
  f[256][256][142] = 534475872;
  f[256][256][143] = 40215357;
  f[256][256][144] = 389728458;
  f[256][256][145] = 286368453;
  f[256][256][146] = 736006257;
  f[256][256][147] = 501181650;
  f[256][256][148] = 54829908;
  f[256][256][149] = 603489402;
  f[256][256][150] = 338032656;
  f[256][256][151] = 512182818;
  f[256][256][152] = 627500097;
  f[256][256][153] = 462674016;
  f[256][256][154] = 3103092;
  f[256][256][155] = 157324491;
  f[256][256][156] = 43978329;
  f[256][256][157] = 596818971;
  f[256][256][158] = 259025598;
  f[256][256][159] = 9088632;
  f[256][256][160] = 91991781;
  f[256][256][161] = 577291428;
  f[256][256][162] = 211245489;
  f[256][256][163] = 429471231;
  f[256][256][164] = 142626330;
  f[256][256][165] = 172560633;
  f[256][256][166] = 510907446;
  f[256][256][167] = 444609585;
  f[256][256][168] = 758102058;
  f[256][256][169] = 375112647;
  f[256][256][170] = 744786693;
  f[256][256][171] = 276174402;
  f[256][256][172] = 19259856;
  f[256][256][173] = 233672418;
  f[256][256][174] = 745389414;
  f[256][256][175] = 225772848;
  f[256][256][176] = 23385663;
  f[256][256][177] = 324290610;
  f[256][256][178] = 519804558;
  f[256][256][179] = 120337812;
  f[256][256][180] = 402578568;
  f[256][256][181] = 360676008;
  f[256][256][182] = 450089262;
  f[256][256][183] = 551043738;
  f[256][256][184] = 337388940;
  f[256][256][185] = 512108856;
  f[256][256][186] = 28879011;
  f[256][256][187] = 690040638;
  f[256][256][188] = 106017282;
  f[256][256][189] = 558262341;
  f[256][256][190] = 99972432;
  f[256][256][191] = 608226003;
  f[256][256][192] = 612152037;
  f[256][256][193] = 42414435;
  f[256][256][194] = 776201013;
  f[256][256][195] = 39580443;
  f[256][256][196] = 518796945;
  f[256][256][197] = 494437752;
  f[256][256][198] = 583194366;
  f[256][256][199] = 723936555;
  f[256][256][200] = 415359657;
  f[256][256][201] = 309569589;
  f[256][256][202] = 751104774;
  f[256][256][203] = 166684527;
  f[256][256][204] = 249229170;
  f[256][256][205] = 353120823;
  f[256][256][206] = 130668327;
  f[256][256][207] = 753823584;
  f[256][256][208] = 580966092;
  f[256][256][209] = 561963717;
  f[256][256][210] = 543672234;
  f[256][256][211] = 393846327;
  f[256][256][212] = 586278000;
  f[256][256][213] = 327398400;
  f[256][256][214] = 278403867;
  f[256][256][215] = 156455586;
  f[256][256][216] = 363920382;
  f[256][256][217] = 190245195;
  f[256][256][218] = 290039148;
  f[256][256][219] = 547014447;
  f[256][256][220] = 466218648;
  f[256][256][221] = 146037150;
  f[256][256][222] = 585462906;
  f[256][256][223] = 666008595;
  f[256][256][224] = 691786683;
  f[256][256][225] = 374707494;
  f[256][256][226] = 622498779;
  f[256][256][227] = 231158277;
  f[256][256][228] = 685740951;
  f[256][256][229] = 115612245;
  f[256][256][230] = 681825249;
  f[256][256][231] = 545555745;
  f[256][256][232] = 551718468;
  f[256][256][233] = 277206615;
  f[256][256][234] = 640171035;
  f[256][256][235] = 757727334;
  f[256][256][236] = 195193908;
  f[256][256][237] = 658656684;
  f[256][256][238] = 457760646;
  f[256][256][239] = 225925875;
  f[256][256][240] = 505761984;
  f[256][256][241] = 18685233;
  f[256][256][242] = 506832921;
  f[256][256][243] = 112511021;
  f[256][256][244] = 396846646;
  f[256][256][245] = 290147622;
  f[256][256][246] = 113924623;
  f[256][256][247] = 669986155;
  f[256][256][248] = 336008070;
  f[256][256][249] = 63611061;
  f[256][256][250] = 238586775;
  f[256][256][251] = 119956662;
  f[256][256][252] = 616557739;
  f[256][256][253] = 772784623;
  f[256][256][254] = 334527774;
  f[256][256][255] = 410403148;
  f[256][256][256] = 51933421;
  int n, k;
  scanf("%d %d", &n, &k);
  printf("%lld\n", f[n][n][k]);
  return 0;
}

```