結果

問題 No.3086 愛国心(2)
ユーザー googol_S0googol_S0
提出日時 2021-04-01 22:34:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 36,215 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 91,500 KB
実行使用メモリ 77,004 KB
最終ジャッジ日時 2024-06-01 04:11:17
合計ジャッジ時間 1,209 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
68,992 KB
testcase_01 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

X=[[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,764,765,762,762,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,764,762,761,763,758,755,762,762,762,764,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,764,762,761,763,753,729,669,637,707,744,759,761,761,764,764,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,762,761,761,748,720,634,496,338,264,411,561,680,734,755,763,761,763,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,762,761,759,741,702,596,450,282,145,170,185,130,168,354,515,647,723,750,763,762,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,764,762,762,764,755,734,676,551,398,228,138,179,205,212,211,208,191,144,150,302,465,608,709,745,760,764,762,765,764,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,762,761,762,751,723,645,510,346,168,142,187,205,212,209,208,208,208,211,210,198,175,143,243,411,560,681,735,755,763,761,762,764,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,762,761,760,744,708,609,464,294,149,165,194,206,212,209,207,208,208,208,207,207,208,211,212,203,188,133,164,353,516,648,724,750,762,761,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,762,762,764,757,736,685,565,415,242,139,180,203,210,211,210,207,208,208,208,208,208,208,208,207,208,207,210,211,205,193,152,149,303,467,609,709,744,759,761,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,764,762,762,763,752,727,655,522,363,182,131,186,207,212,209,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,210,210,202,173,140,246,412,561,681,735,756,764,762,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,764,765,765,765,764,765,765,765,765,765,765,763,765,765,765,765,765,762,765,765,765,764,764,761,760,759,747,715,621,475,313,156,152,186,204,212,208,204,208,205,208,208,205,208,208,205,208,208,205,208,208,208,208,208,205,205,208,207,209,212,205,184,136,179,355,515,648,724,751,762,762,762,765,765,765,765,765,762,765,762,765,765,765,765,763,765,764,765,765,764,764,765,765,765,765,765,765,765,765,765],[765,764,765,765,765,764,765,765,765,765,765,765,762,765,765,765,765,765,762,765,765,764,761,761,757,738,691,579,430,254,141,176,198,208,209,206,207,207,205,208,205,208,208,205,208,208,205,208,208,205,208,208,208,208,208,205,205,208,207,208,207,209,212,203,193,161,150,299,467,610,708,744,759,761,762,765,765,765,762,765,762,765,765,765,765,762,765,764,765,765,764,764,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,762,762,763,753,729,664,536,378,190,132,186,205,210,211,208,206,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,210,212,209,201,179,139,242,413,561,680,734,756,764,762,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,765,762,762,762,749,719,632,493,329,157,137,190,208,211,209,209,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,212,208,187,131,177,355,514,649,724,751,762,762,762,765,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,764,764,761,763,759,742,700,593,446,278,148,165,194,208,211,208,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,213,207,190,154,153,302,465,609,708,744,760,764,761,764,764,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,764,761,763,755,733,674,551,393,210,137,183,201,211,211,208,206,207,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,207,207,209,212,209,198,179,141,234,411,561,680,735,755,763,761,763,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,762,762,763,750,722,643,508,344,161,132,189,204,211,211,208,207,207,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,207,206,208,211,211,205,188,129,165,354,515,648,723,750,763,762,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,762,762,764,760,745,709,607,461,296,149,153,195,207,210,208,209,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,209,209,210,207,192,145,149,303,465,609,709,745,760,764,762,762,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,764,757,737,684,563,412,241,142,174,200,211,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,210,210,199,173,142,244,411,561,681,736,756,764,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,761,731,647,523,361,170,138,188,203,212,210,207,208,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,207,211,212,203,187,138,168,357,517,638,728,760,764,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,764,739,583,301,146,152,189,208,215,211,208,207,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,207,208,211,215,208,191,156,140,264,562,733,763,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,764,751,679,546,388,217,140,185,202,211,211,207,207,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,207,206,208,211,212,202,186,140,209,377,532,670,749,764,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,764,758,751,737,694,588,439,272,146,166,195,208,211,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,211,208,195,166,146,266,433,581,689,736,749,758,764,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,756,701,691,736,753,747,716,627,487,325,157,137,189,207,211,209,209,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,209,209,210,208,190,137,156,323,485,623,714,746,751,733,684,708,757,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,738,550,383,531,659,727,751,751,728,660,533,376,188,132,187,204,211,211,208,206,207,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,211,211,204,186,133,192,377,533,659,727,750,749,724,649,514,369,580,743,762,765,765,765,765,765,765,765,765],[765,765,765,765,762,736,503,124,159,325,483,621,713,745,752,738,689,577,432,260,144,175,196,207,211,209,207,207,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,207,207,209,212,206,196,173,145,267,436,580,690,737,751,743,706,609,468,308,147,126,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,507,142,190,170,145,264,429,574,686,737,752,745,712,621,482,318,156,143,187,207,212,208,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,213,207,187,141,159,326,489,626,715,746,751,734,678,560,413,247,142,175,192,152,544,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,764,736,503,128,204,216,202,185,135,184,368,527,654,726,749,750,727,656,527,369,190,132,186,207,211,208,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,210,211,205,182,136,211,383,536,661,728,750,749,723,645,514,354,170,139,187,203,216,202,136,541,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,200,212,210,211,204,191,143,151,314,478,615,710,744,752,737,685,571,426,256,140,175,201,209,211,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,207,210,211,206,198,168,142,274,440,584,692,738,751,742,703,605,465,300,148,157,193,205,211,210,212,199,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,207,208,210,210,209,202,172,141,256,421,567,682,735,751,744,711,616,476,310,153,159,192,204,212,209,207,208,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,207,210,212,203,189,144,157,330,493,628,716,746,750,733,675,556,407,241,139,177,204,210,211,209,208,208,211,198,133,541,742,762,765,765,765,765,765,765,765,765],[765,764,765,765,765,736,503,125,199,211,208,208,205,208,208,209,213,206,179,132,186,364,519,648,724,748,748,726,652,522,361,183,135,182,202,210,209,207,205,208,205,208,208,205,208,208,205,208,208,205,208,208,208,208,208,205,205,208,208,207,210,211,201,176,138,214,386,539,663,729,750,748,722,641,510,352,175,132,181,206,210,209,208,208,208,205,208,208,198,133,538,741,762,765,765,765,765,765,765,765,765],[765,764,765,765,765,736,503,125,199,211,208,208,205,208,208,208,208,209,210,204,191,160,154,305,470,607,703,743,751,735,679,565,417,251,139,169,202,210,207,208,206,208,208,205,208,208,205,208,208,205,208,208,208,208,208,205,206,209,210,208,197,159,146,277,443,587,693,739,751,741,700,600,459,293,152,164,193,205,209,209,205,208,208,208,208,205,208,208,198,133,538,741,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,208,208,208,208,207,208,212,209,200,178,139,242,414,560,676,733,750,743,707,610,470,305,149,152,194,205,211,210,207,208,207,208,208,208,208,208,208,207,207,206,208,211,211,206,190,134,157,333,495,630,718,747,750,732,672,552,402,228,137,181,201,209,212,208,207,208,208,208,208,208,208,208,208,211,198,133,541,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,208,208,208,208,208,208,207,209,210,210,206,188,130,173,353,512,643,722,747,748,724,648,516,353,165,134,188,203,211,211,207,207,207,208,208,207,207,206,208,211,210,201,183,136,206,388,542,665,730,750,748,720,638,504,344,163,129,189,207,211,210,209,207,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,211,207,190,148,151,300,462,602,703,742,749,734,677,558,409,241,142,175,199,211,211,207,208,207,207,208,211,207,192,163,149,281,447,589,695,739,751,741,699,596,454,291,149,153,192,208,211,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,208,208,208,208,208,208,208,208,208,207,207,206,207,211,209,198,178,141,234,404,553,673,732,749,742,703,604,462,297,149,149,193,208,210,209,211,208,188,131,160,337,498,633,719,747,750,731,669,548,397,223,140,180,200,210,211,207,206,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,541,742,762,765,765,765,765,765,765,765,765],[765,764,765,765,765,736,503,125,199,211,208,208,205,208,208,208,208,208,206,209,207,207,207,208,208,205,204,206,208,211,209,203,188,131,159,343,506,638,720,746,746,722,642,507,348,163,127,190,203,180,136,222,394,544,667,730,749,748,719,635,501,340,159,133,189,203,211,211,208,206,207,207,208,208,208,208,208,208,205,208,205,208,208,208,208,205,208,209,198,133,538,741,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,208,208,208,206,207,209,212,208,206,207,207,208,208,208,208,207,207,210,210,207,196,156,147,290,455,596,699,740,748,732,673,553,402,226,149,282,451,594,697,740,751,740,697,593,449,286,146,161,197,207,211,210,207,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,541,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,762,736,503,125,199,211,208,208,208,208,208,208,206,206,196,164,189,206,211,208,207,207,208,208,208,208,208,208,208,208,210,211,202,175,139,231,398,545,667,730,748,741,702,602,544,636,720,748,750,730,666,544,393,225,138,176,203,212,211,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,207,206,207,185,289,345,192,131,187,208,211,209,208,208,208,208,208,208,208,208,208,207,209,213,204,188,143,162,338,499,634,719,746,748,742,752,748,718,631,496,334,162,144,188,204,213,209,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,207,207,207,125,391,640,568,393,205,135,189,206,211,210,207,208,208,208,208,208,208,207,207,208,211,213,206,194,166,145,282,446,616,740,763,740,615,443,278,144,168,195,206,212,210,207,208,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,207,207,208,117,409,715,744,698,583,421,229,139,186,203,212,210,208,208,207,208,208,208,208,208,208,207,210,210,210,206,190,131,361,689,757,690,362,131,192,206,209,210,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,200,212,208,208,208,208,207,207,208,117,419,718,764,761,747,710,603,444,262,146,178,201,212,209,207,208,208,208,208,208,208,208,208,208,207,209,217,181,351,682,756,684,355,179,218,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,200,212,208,208,208,208,207,207,208,116,423,717,763,760,761,763,750,718,621,467,290,149,170,202,212,209,207,208,208,208,208,208,208,208,207,208,210,166,355,683,756,685,357,164,210,209,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,200,212,208,208,208,208,207,207,210,122,423,712,762,759,763,762,762,763,752,722,637,488,313,152,165,200,208,207,208,208,208,208,208,208,208,207,209,165,352,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,207,207,211,174,339,590,713,748,762,762,762,763,762,764,753,728,652,509,333,158,176,205,207,208,208,208,208,208,208,207,209,165,353,682,755,683,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,208,208,207,205,202,259,428,589,704,745,760,762,762,764,761,763,756,733,667,525,337,194,207,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,762,736,503,125,199,211,208,208,208,208,208,208,208,206,205,185,140,216,403,567,692,741,759,761,762,764,762,764,757,719,508,141,198,211,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,208,208,208,208,209,212,204,189,135,173,378,550,680,737,757,761,762,764,758,740,533,133,197,211,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,208,208,208,208,208,207,210,210,205,190,140,164,357,529,666,732,756,763,758,739,525,131,197,212,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,200,212,208,208,208,208,208,208,208,208,208,208,208,208,208,210,208,192,143,158,336,509,653,728,753,738,523,131,198,212,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,541,742,762,765,765,765,765,765,765,765,765],[765,764,765,765,765,736,503,125,200,212,208,208,205,208,208,208,208,208,205,208,208,208,208,208,207,208,206,195,166,155,310,489,634,701,514,131,198,212,205,208,205,208,208,205,209,165,351,682,755,681,355,163,210,207,208,205,205,208,208,208,208,208,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,205,208,208,208,208,205,208,209,198,133,538,741,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,200,212,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,208,211,210,199,176,146,278,461,407,173,201,210,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,541,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,200,212,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,207,208,211,211,203,178,141,196,203,205,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,126,200,212,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,209,212,207,205,206,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,541,742,762,765,765,765,765,765,765,765,765],[765,764,765,765,765,736,503,125,200,212,208,208,205,208,208,208,208,208,205,208,208,208,208,208,208,205,205,208,208,208,205,208,207,208,206,205,208,208,205,208,205,208,208,205,209,165,350,682,755,681,355,163,210,207,208,205,205,208,208,208,208,208,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,205,208,208,208,208,205,208,208,198,133,538,741,762,765,765,765,765,765,765,765,765],[765,764,765,765,765,736,503,125,200,212,208,208,205,208,208,208,208,208,205,208,208,208,208,208,208,205,205,208,208,208,205,208,208,208,205,205,208,208,205,208,205,208,208,205,209,165,350,682,755,681,355,163,210,207,208,205,205,208,208,208,208,208,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,205,208,208,208,208,205,208,208,198,133,538,741,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,200,212,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,541,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,200,212,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,199,211,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,200,212,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,211,198,133,540,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,736,503,125,200,211,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,210,198,135,541,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,764,736,505,128,200,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,211,201,142,542,742,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,735,498,117,199,215,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,216,198,126,535,741,762,765,765,765,765,765,765,765,765],[765,765,765,765,762,742,545,152,128,191,208,210,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,209,209,211,208,190,128,178,578,747,762,765,765,765,765,765,765,765,765],[765,765,765,765,765,760,713,570,407,209,136,189,204,211,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,207,210,211,205,187,139,238,427,586,723,761,765,765,765,765,765,765,765,765,765],[765,764,765,765,765,762,761,745,705,590,425,233,138,185,203,212,209,207,205,207,208,208,208,208,208,205,205,208,208,208,205,208,208,208,205,205,208,208,205,208,205,208,208,205,209,165,351,682,755,681,355,163,210,207,208,205,205,208,208,208,208,208,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,207,208,212,202,184,144,252,443,603,714,748,760,762,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,762,761,762,749,713,603,441,257,144,179,204,213,208,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,212,203,175,147,275,458,617,717,750,762,761,763,765,765,765,765,765,765,765,765,765,765],[765,764,765,765,765,762,764,764,762,762,763,750,715,616,457,277,145,178,203,212,209,209,208,208,208,205,205,208,208,208,205,208,208,208,205,205,208,208,205,208,205,208,208,205,209,165,351,682,755,681,355,163,210,207,208,205,205,208,208,208,208,208,208,205,208,208,208,208,208,208,208,208,208,208,208,209,209,212,201,174,146,293,472,627,721,751,763,760,762,764,763,762,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,762,763,751,720,628,474,291,147,178,203,211,211,208,207,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,206,208,211,210,200,172,150,307,487,638,724,753,763,763,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,764,765,765,765,762,765,765,765,765,765,765,762,761,763,753,724,639,486,306,152,174,198,210,211,205,205,207,208,208,205,208,208,208,205,205,208,208,205,208,205,208,208,205,209,165,351,682,755,681,355,163,210,207,208,205,205,208,208,208,208,208,208,205,208,208,208,208,208,207,208,208,211,209,197,170,155,321,499,649,727,754,763,761,764,762,765,762,765,765,762,763,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,764,764,761,763,754,728,650,503,324,158,161,195,210,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,210,209,192,156,160,336,514,659,731,756,763,761,764,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,764,762,764,756,731,659,515,340,159,147,195,209,210,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,209,208,192,142,162,351,526,667,733,757,764,762,765,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,762,761,756,733,669,530,354,162,143,192,206,211,209,207,208,208,208,208,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,208,208,208,208,207,209,211,206,190,138,166,365,540,675,736,758,761,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,762,761,757,737,678,543,368,168,143,190,205,212,209,207,207,207,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,207,207,207,209,212,205,189,141,173,379,553,685,739,759,761,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,761,761,759,740,687,556,385,191,141,186,206,212,208,207,208,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,208,206,208,212,206,185,138,204,395,564,693,742,760,761,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,764,762,762,760,743,696,570,403,216,137,188,208,211,209,208,208,208,208,208,207,209,165,353,682,755,684,355,163,210,207,208,208,208,208,208,209,211,208,186,138,226,412,579,700,744,761,762,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,762,762,761,744,703,585,421,231,138,188,205,211,210,207,208,207,207,209,165,353,682,755,684,355,163,210,207,207,208,207,210,210,205,187,139,241,429,593,707,746,761,762,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,762,761,761,746,710,600,437,245,141,185,202,211,211,207,207,209,165,353,682,755,684,355,163,210,207,207,211,212,202,184,143,253,443,606,714,748,762,761,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,764,762,761,762,749,715,612,452,268,146,178,202,212,210,210,166,353,682,755,683,355,164,210,210,213,202,178,147,275,458,617,717,750,762,761,762,764,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,764,762,762,763,751,719,623,467,287,147,174,204,214,167,353,682,755,683,356,166,216,205,172,149,293,472,627,721,752,763,762,762,764,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,763,762,763,752,722,635,483,304,151,181,175,356,683,755,684,359,173,182,152,308,487,638,724,753,763,762,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,761,763,753,726,646,500,323,148,337,681,756,683,340,150,327,503,649,727,754,763,761,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,764,765,765,765,764,765,765,765,765,765,765,764,765,765,765,765,765,764,765,765,765,765,765,765,764,763,765,765,765,762,765,765,765,762,762,765,765,763,764,759,763,755,729,658,510,468,695,755,694,476,513,660,731,756,760,758,764,764,765,765,765,765,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,765,764,765,765,765,765,764,765,764,765,765,764,764,765,765,765,765,765,765,765,765,765],[765,764,765,765,765,764,765,765,765,765,765,765,764,765,765,765,765,765,764,765,765,765,765,765,765,763,762,765,765,765,763,765,765,765,762,762,765,765,762,765,763,765,762,761,757,733,703,745,761,743,707,734,757,764,762,762,763,765,765,765,765,765,765,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,764,765,764,765,765,765,765,764,765,764,765,765,764,764,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,762,764,761,763,764,763,761,764,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,762,765,765,765,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765]]
for t in range(int(input())):
  a,b=map(int,input().split())
  print(X[a][b])
0