結果

問題 No.8086 愛国心(2)
ユーザー googol_S0googol_S0
提出日時 2021-04-01 22:49:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 36,342 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 91,784 KB
実行使用メモリ 77,432 KB
最終ジャッジ日時 2024-12-21 06:59:21
合計ジャッジ時間 1,060 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
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,765,765,765,765,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,765,765,765,762,763,765,762,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,762,762,762,763,752,728,739,762,762,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,762,762,762,762,746,688,577,459,502,640,720,756,762,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,764,762,762,762,762,733,662,539,372,251,200,207,285,437,601,697,750,762,762,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,762,764,764,762,756,715,631,488,326,227,167,159,196,175,138,177,257,390,554,670,738,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,762,762,762,765,750,696,593,428,282,205,154,166,208,218,213,215,217,188,147,171,237,340,503,640,721,758,765,765,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,762,762,762,762,738,671,551,383,259,182,143,179,213,216,210,205,208,205,207,213,218,204,163,159,209,282,435,600,698,750,762,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,762,765,765,762,759,721,641,504,339,235,170,155,196,216,215,208,205,208,208,208,208,208,205,208,211,216,213,175,138,177,259,390,556,672,738,762,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,762,762,762,765,752,701,605,447,291,208,159,166,208,217,212,208,208,208,208,208,208,208,208,208,208,208,208,208,210,215,216,192,150,171,236,343,504,639,720,756,762,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,762,762,765,765,765,744,679,565,399,265,185,141,174,213,216,210,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,213,219,204,163,159,211,290,440,599,697,750,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,762,762,762,762,759,729,653,518,352,245,175,150,189,213,216,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,207,205,211,217,211,174,144,187,263,387,554,672,738,762,762,762,762,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,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,762,765,762,762,753,709,619,461,302,216,161,163,203,216,213,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,209,215,216,194,153,172,237,340,504,640,719,756,762,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,762,762,762,765,745,685,578,415,268,186,144,173,212,216,211,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,213,216,207,166,159,207,288,440,599,697,750,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,762,762,765,762,762,733,660,534,370,251,175,141,182,216,216,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,210,217,214,174,140,182,262,390,554,672,738,762,762,765,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,762,762,762,762,756,715,631,479,318,227,168,156,199,217,213,207,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,216,216,190,150,173,238,337,500,640,721,757,762,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,762,765,762,762,748,694,593,426,275,195,149,168,208,217,213,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,213,216,205,165,156,206,283,436,601,697,750,762,762,764,762,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,762,762,738,668,551,385,254,176,140,179,214,216,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,208,208,208,208,208,208,208,208,208,205,208,211,216,213,174,138,176,257,390,555,670,738,762,762,765,765,762,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,762,765,759,722,640,501,338,234,169,151,193,217,214,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,215,217,188,146,170,237,342,504,640,721,758,765,762,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,753,706,607,439,287,210,159,164,205,218,212,205,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,207,213,218,204,162,159,211,285,436,603,702,750,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,762,712,550,363,261,190,148,179,212,216,211,206,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,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,206,208,212,216,211,179,147,189,260,346,529,704,762,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,762,694,498,284,166,138,177,216,219,212,206,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,207,212,219,216,178,138,163,264,473,684,759,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,763,747,700,621,482,322,224,165,157,199,217,214,207,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,207,213,217,199,158,164,220,314,472,613,696,744,762,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,750,742,756,759,728,655,528,364,248,174,141,182,217,216,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,207,208,216,216,182,141,174,247,361,522,651,725,759,753,741,753,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,691,570,599,707,752,765,744,682,574,411,268,186,143,171,211,216,211,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,212,217,211,170,144,187,267,410,572,681,742,765,750,700,584,575,706,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,648,345,242,415,571,679,741,765,753,706,616,458,302,219,164,162,202,216,213,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,214,216,201,160,166,222,304,461,616,706,752,762,736,671,558,397,226,363,673,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,288,95,183,247,358,520,649,724,759,759,726,651,520,355,246,176,144,183,216,216,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,209,217,215,181,143,178,252,361,525,654,727,759,756,718,638,504,343,239,178,94,315,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,297,145,210,159,164,220,299,452,610,703,750,762,741,679,568,405,266,186,143,171,213,217,210,205,208,208,208,208,208,208,208,208,208,208,208,208,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,218,211,169,150,195,271,412,574,683,743,765,748,697,599,435,288,214,160,163,211,148,324,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,287,132,223,219,210,171,142,184,263,402,565,676,739,762,751,703,610,454,299,216,163,163,204,216,213,208,208,208,208,208,208,208,208,208,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,213,217,200,158,165,224,314,471,619,707,753,762,735,669,554,387,261,182,142,176,211,218,220,133,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,210,216,216,184,145,174,243,351,512,643,721,757,759,723,647,515,349,242,174,152,191,216,215,209,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,206,206,211,216,214,183,144,178,250,366,530,654,727,759,756,716,634,498,338,237,171,151,192,216,214,210,208,216,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,288,133,217,208,207,208,208,213,219,204,162,161,213,295,448,604,698,750,765,741,677,562,397,267,190,144,171,211,217,211,205,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,205,212,218,208,167,151,199,273,415,578,685,744,765,747,694,594,435,285,206,157,165,208,219,213,208,207,208,208,216,132,314,676,765,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,288,133,217,208,208,208,208,208,205,211,219,211,170,143,191,267,392,557,673,735,762,750,701,604,446,294,212,160,160,204,219,213,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,208,213,217,197,154,166,226,317,474,620,709,753,762,733,667,548,383,262,186,141,172,213,218,211,205,208,208,208,208,208,216,132,314,673,765,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,288,133,217,208,208,208,208,208,208,208,205,210,216,215,191,152,174,239,340,503,640,718,756,756,720,641,507,345,238,172,150,192,216,215,210,208,208,208,208,208,208,208,208,208,208,208,208,205,208,211,216,215,180,140,175,249,371,534,657,729,759,756,715,632,490,329,234,171,154,195,216,215,209,205,208,208,208,208,208,208,208,216,132,314,676,765,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,208,205,208,213,216,205,163,159,209,287,437,596,694,747,762,737,672,558,391,259,179,139,175,213,216,211,208,205,208,208,208,208,208,208,205,208,212,216,208,168,149,193,272,418,581,685,744,765,747,691,590,427,278,202,155,166,208,217,213,208,205,208,208,208,208,208,208,208,208,208,216,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,208,208,208,207,208,210,216,213,174,140,178,257,386,551,668,735,762,750,697,599,432,282,209,159,164,205,218,213,207,205,208,208,205,208,215,216,195,155,168,229,315,473,624,710,753,762,732,663,543,381,255,175,137,176,215,216,210,208,207,208,208,208,208,208,208,208,208,208,208,208,216,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,215,217,188,148,171,238,334,493,634,715,756,756,718,636,498,337,236,170,149,192,218,215,208,208,216,215,176,138,177,255,373,536,660,730,759,754,713,628,484,326,234,170,151,192,217,215,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,216,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,288,133,217,208,208,208,208,208,208,208,208,208,208,207,208,208,208,208,208,205,207,213,217,205,165,157,205,277,426,593,691,747,762,735,669,551,385,256,176,139,175,216,209,168,154,198,274,421,584,688,747,765,745,688,587,422,276,201,153,166,207,217,213,206,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,216,132,314,676,765,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,288,133,217,208,208,208,208,208,208,208,208,208,213,213,208,205,208,208,208,208,208,205,208,211,216,213,175,139,178,255,379,545,663,732,762,747,693,594,429,278,202,152,166,228,323,483,625,711,755,762,731,660,539,375,254,178,140,178,213,216,210,208,206,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,216,132,314,676,765,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,203,181,188,215,215,208,205,208,208,208,208,208,207,208,208,215,218,193,152,168,230,329,488,628,712,753,756,715,634,489,343,377,539,662,730,759,753,711,625,483,325,227,166,155,198,218,215,208,208,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,216,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,201,217,239,193,144,176,216,216,208,207,208,208,208,208,208,208,208,208,212,218,206,164,156,207,279,421,584,688,745,762,732,684,694,746,765,744,687,581,420,277,203,153,165,208,219,213,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,205,215,167,231,452,455,291,189,149,175,215,216,210,208,208,208,208,208,208,208,206,205,211,217,213,180,143,180,254,371,536,660,735,762,762,735,660,533,368,253,180,144,180,213,217,211,205,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,216,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,205,219,142,228,578,721,634,474,307,206,156,170,211,216,211,208,208,208,208,208,208,208,208,208,210,215,216,197,156,173,223,353,609,755,756,611,353,221,171,156,199,216,215,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,216,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,205,219,142,232,590,762,762,730,651,500,326,222,163,166,207,217,211,205,207,208,208,208,208,208,208,208,208,211,216,217,154,201,520,747,747,522,202,154,219,216,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,216,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,205,219,141,236,592,762,762,762,762,738,663,525,353,236,169,161,203,218,211,205,208,208,208,208,208,208,208,208,205,217,190,239,528,747,747,530,240,188,217,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,205,220,139,240,599,762,762,760,762,762,765,743,675,548,374,246,172,157,199,216,210,208,208,208,208,208,208,208,207,214,174,228,529,747,747,530,227,172,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,208,216,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,205,217,161,241,550,738,762,762,762,762,762,764,765,747,685,568,394,255,177,159,197,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,176,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,210,198,216,334,510,654,733,762,762,762,762,762,762,762,750,697,587,412,269,216,203,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,201,188,216,315,485,640,725,759,762,762,762,762,765,765,755,707,560,281,164,213,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,208,208,172,153,199,286,451,624,718,756,762,762,762,762,762,762,670,310,132,215,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,208,210,215,214,177,140,181,274,432,605,706,753,762,765,759,759,667,307,132,216,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,213,216,183,144,175,263,416,587,697,751,762,762,663,303,133,216,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,213,217,187,145,177,258,393,568,686,747,666,304,131,216,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,676,765,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,207,213,217,198,156,174,248,366,550,583,299,149,213,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,676,765,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,206,208,212,216,204,162,163,238,298,241,187,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,210,217,208,166,162,199,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,210,216,215,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,676,765,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,208,208,208,208,208,205,208,205,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,205,208,208,208,208,208,208,208,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,132,314,673,765,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,676,765,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,288,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,650,287,133,217,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,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,132,314,675,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,651,290,132,216,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,215,137,320,676,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,648,286,138,225,208,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,209,225,141,314,673,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,655,282,85,183,217,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,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,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,216,179,91,314,679,762,762,765,765,765,765,765,765,765],[765,765,765,765,765,765,712,487,277,199,150,174,213,215,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,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,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,216,212,172,158,212,293,513,724,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,762,727,643,484,310,209,157,171,211,216,210,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,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,211,216,209,168,162,219,330,507,656,735,762,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,762,762,734,654,503,327,219,163,166,208,217,210,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,211,218,206,164,167,230,344,521,663,739,762,762,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,762,762,762,765,738,663,521,345,228,165,165,208,217,210,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,207,211,218,206,162,168,236,361,536,672,743,765,762,762,762,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,762,765,765,765,742,669,537,362,237,168,164,206,217,212,208,207,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,208,212,216,203,161,171,243,374,551,678,744,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,762,762,744,679,551,374,244,172,161,202,216,213,208,206,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,206,208,213,216,199,157,175,252,387,565,687,747,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,762,762,762,762,747,688,565,388,254,177,154,196,218,213,206,206,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,207,213,216,193,151,179,261,401,577,694,750,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,762,762,764,765,750,694,578,404,259,177,147,191,218,213,208,208,208,208,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,208,208,208,208,208,213,217,186,144,177,265,413,590,700,753,765,765,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,764,765,765,762,753,700,590,418,263,175,146,186,216,213,208,207,208,208,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,208,208,207,208,213,215,183,143,177,268,426,601,706,753,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,762,762,762,753,708,604,428,270,178,144,183,215,215,208,205,208,208,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,208,208,205,208,215,214,180,144,180,275,438,613,712,756,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,762,762,762,756,715,616,441,280,190,148,178,215,216,208,205,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,205,208,216,213,174,150,196,285,451,625,719,759,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,762,762,762,762,759,721,628,461,295,200,151,174,215,216,208,208,208,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,208,208,208,216,214,173,154,204,303,473,634,725,759,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,762,762,762,762,726,639,482,311,207,157,173,213,216,210,208,208,208,205,213,176,228,527,747,747,530,228,175,215,205,208,208,208,210,216,213,172,158,212,318,493,645,729,762,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,762,762,762,762,731,650,500,324,214,159,170,210,216,211,208,205,213,176,228,527,747,747,530,228,175,215,205,208,211,216,209,168,161,219,332,509,655,735,762,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,762,762,762,762,736,660,513,337,226,165,165,208,217,210,213,177,228,527,747,747,530,228,175,214,210,217,207,164,167,230,344,521,664,739,762,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,762,762,762,765,741,668,531,356,234,167,163,205,226,179,228,527,747,747,530,227,179,226,204,162,170,237,361,537,672,742,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,762,763,763,765,744,675,545,371,243,171,170,178,239,530,747,747,533,240,178,170,171,244,375,551,678,744,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,763,765,762,762,747,684,561,384,258,160,202,522,747,747,525,202,162,261,387,565,687,747,762,762,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,762,762,750,693,579,390,307,536,746,747,540,310,394,581,694,750,762,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,764,765,765,765,765,765,765,765,765,762,765,765,765,765,765,765,765,765,753,696,607,651,752,753,653,609,697,753,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,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,756,753,762,762,753,756,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765],[765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,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())
  C=0
  S=0
  for x in range(-2,3):
    for y in range(-2,3):
      if 0<=a+x<=88 and 0<=b+y<=100:
        S+=X[a+x][b+y]
        C+=1
  print(S/C)
0