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

### Prompt

In CPP, your task is to solve the following problem:

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

```