#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
using namespace std;
typedef long long int ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll q, A[2];
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> A[0] >> A[1];
		A[0]--;
		for (int i = 0; i < 2; i++) {
			if (A[i]<	3)A[i] = 0;
			else	if (A[i]<	5)A[i] = 1;
			else	if (A[i]<	13)A[i] = 2;
			else	if (A[i]<	37)A[i] = 3;
			else	if (A[i]<	61)A[i] = 4;
			else	if (A[i]<	73)A[i] = 5;
			else	if (A[i]<	157)A[i] = 6;
			else	if (A[i]<	193)A[i] = 7;
			else	if (A[i]<	277)A[i] = 8;
			else	if (A[i]<	313)A[i] = 9;
			else	if (A[i]<	397)A[i] = 10;
			else	if (A[i]<	421)A[i] = 11;
			else	if (A[i]<	457)A[i] = 12;
			else	if (A[i]<	541)A[i] = 13;
			else	if (A[i]<	613)A[i] = 14;
			else	if (A[i]<	661)A[i] = 15;
			else	if (A[i]<	673)A[i] = 16;
			else	if (A[i]<	733)A[i] = 17;
			else	if (A[i]<	757)A[i] = 18;
			else	if (A[i]<	877)A[i] = 19;
			else	if (A[i]<	997)A[i] = 20;
			else	if (A[i]<	1093)A[i] = 21;
			else	if (A[i]<	1153)A[i] = 22;
			else	if (A[i]<	1201)A[i] = 23;
			else	if (A[i]<	1213)A[i] = 24;
			else	if (A[i]<	1237)A[i] = 25;
			else	if (A[i]<	1321)A[i] = 26;
			else	if (A[i]<	1381)A[i] = 27;
			else	if (A[i]<	1453)A[i] = 28;
			else	if (A[i]<	1621)A[i] = 29;
			else	if (A[i]<	1657)A[i] = 30;
			else	if (A[i]<	1753)A[i] = 31;
			else	if (A[i]<	1873)A[i] = 32;
			else	if (A[i]<	1933)A[i] = 33;
			else	if (A[i]<	1993)A[i] = 34;
			else	if (A[i]<	2017)A[i] = 35;
			else	if (A[i]<	2137)A[i] = 36;
			else	if (A[i]<	2341)A[i] = 37;
			else	if (A[i]<	2473)A[i] = 38;
			else	if (A[i]<	2557)A[i] = 39;
			else	if (A[i]<	2593)A[i] = 40;
			else	if (A[i]<	2797)A[i] = 41;
			else	if (A[i]<	2857)A[i] = 42;
			else	if (A[i]<	2917)A[i] = 43;
			else	if (A[i]<	3061)A[i] = 44;
			else	if (A[i]<	3217)A[i] = 45;
			else	if (A[i]<	3253)A[i] = 46;
			else	if (A[i]<	3313)A[i] = 47;
			else	if (A[i]<	3517)A[i] = 48;
			else	if (A[i]<	3733)A[i] = 49;
			else	if (A[i]<	4021)A[i] = 50;
			else	if (A[i]<	4057)A[i] = 51;
			else	if (A[i]<	4177)A[i] = 52;
			else	if (A[i]<	4261)A[i] = 53;
			else	if (A[i]<	4273)A[i] = 54;
			else	if (A[i]<	4357)A[i] = 55;
			else	if (A[i]<	4441)A[i] = 56;
			else	if (A[i]<	4561)A[i] = 57;
			else	if (A[i]<	4621)A[i] = 58;
			else	if (A[i]<	4933)A[i] = 59;
			else	if (A[i]<	5077)A[i] = 60;
			else	if (A[i]<	5101)A[i] = 61;
			else	if (A[i]<	5113)A[i] = 62;
			else	if (A[i]<	5233)A[i] = 63;
			else	if (A[i]<	5413)A[i] = 64;
			else	if (A[i]<	5437)A[i] = 65;
			else	if (A[i]<	5581)A[i] = 66;
			else	if (A[i]<	5701)A[i] = 67;
			else	if (A[i]<	6037)A[i] = 68;
			else	if (A[i]<	6073)A[i] = 69;
			else	if (A[i]<	6121)A[i] = 70;
			else	if (A[i]<	6133)A[i] = 71;
			else	if (A[i]<	6217)A[i] = 72;
			else	if (A[i]<	6337)A[i] = 73;
			else	if (A[i]<	6361)A[i] = 74;
			else	if (A[i]<	6373)A[i] = 75;
			else	if (A[i]<	6637)A[i] = 76;
			else	if (A[i]<	6661)A[i] = 77;
			else	if (A[i]<	6781)A[i] = 78;
			else	if (A[i]<	6997)A[i] = 79;
			else	if (A[i]<	7057)A[i] = 80;
			else	if (A[i]<	7213)A[i] = 81;
			else	if (A[i]<	7393)A[i] = 82;
			else	if (A[i]<	7417)A[i] = 83;
			else	if (A[i]<	7477)A[i] = 84;
			else	if (A[i]<	7537)A[i] = 85;
			else	if (A[i]<	7753)A[i] = 86;
			else	if (A[i]<	7933)A[i] = 87;
			else	if (A[i]<	8053)A[i] = 88;
			else	if (A[i]<	8101)A[i] = 89;
			else	if (A[i]<	8221)A[i] = 90;
			else	if (A[i]<	8317)A[i] = 91;
			else	if (A[i]<	8353)A[i] = 92;
			else	if (A[i]<	8461)A[i] = 93;
			else	if (A[i]<	8521)A[i] = 94;
			else	if (A[i]<	8677)A[i] = 95;
			else	if (A[i]<	8713)A[i] = 96;
			else	if (A[i]<	8893)A[i] = 97;
			else	if (A[i]<	9013)A[i] = 98;
			else	if (A[i]<	9133)A[i] = 99;
			else	if (A[i]<	9181)A[i] = 100;
			else	if (A[i]<	9241)A[i] = 101;
			else	if (A[i]<	9277)A[i] = 102;
			else	if (A[i]<	9601)A[i] = 103;
			else	if (A[i]<	9661)A[i] = 104;
			else	if (A[i]<	9721)A[i] = 105;
			else	if (A[i]<	9817)A[i] = 106;
			else	if (A[i]<	9901)A[i] = 107;
			else	if (A[i]<	9973)A[i] = 108;
			else	if (A[i]<	10333)A[i] = 109;
			else	if (A[i]<	10357)A[i] = 110;
			else	if (A[i]<	10453)A[i] = 111;
			else	if (A[i]<	10837)A[i] = 112;
			else	if (A[i]<	10861)A[i] = 113;
			else	if (A[i]<	10957)A[i] = 114;
			else	if (A[i]<	11113)A[i] = 115;
			else	if (A[i]<	11161)A[i] = 116;
			else	if (A[i]<	11317)A[i] = 117;
			else	if (A[i]<	11497)A[i] = 118;
			else	if (A[i]<	11677)A[i] = 119;
			else	if (A[i]<	11701)A[i] = 120;
			else	if (A[i]<	12073)A[i] = 121;
			else	if (A[i]<	12157)A[i] = 122;
			else	if (A[i]<	12241)A[i] = 123;
			else	if (A[i]<	12301)A[i] = 124;
			else	if (A[i]<	12421)A[i] = 125;
			else	if (A[i]<	12433)A[i] = 126;
			else	if (A[i]<	12457)A[i] = 127;
			else	if (A[i]<	12541)A[i] = 128;
			else	if (A[i]<	12553)A[i] = 129;
			else	if (A[i]<	12601)A[i] = 130;
			else	if (A[i]<	12721)A[i] = 131;
			else	if (A[i]<	12757)A[i] = 132;
			else	if (A[i]<	12841)A[i] = 133;
			else	if (A[i]<	12853)A[i] = 134;
			else	if (A[i]<	13093)A[i] = 135;
			else	if (A[i]<	13381)A[i] = 136;
			else	if (A[i]<	13417)A[i] = 137;
			else	if (A[i]<	13681)A[i] = 138;
			else	if (A[i]<	13921)A[i] = 139;
			else	if (A[i]<	13933)A[i] = 140;
			else	if (A[i]<	14437)A[i] = 141;
			else	if (A[i]<	14593)A[i] = 142;
			else	if (A[i]<	14737)A[i] = 143;
			else	if (A[i]<	14821)A[i] = 144;
			else	if (A[i]<	15013)A[i] = 145;
			else	if (A[i]<	15073)A[i] = 146;
			else	if (A[i]<	15121)A[i] = 147;
			else	if (A[i]<	15241)A[i] = 148;
			else	if (A[i]<	15277)A[i] = 149;
			else	if (A[i]<	15361)A[i] = 150;
			else	if (A[i]<	15373)A[i] = 151;
			else	if (A[i]<	15733)A[i] = 152;
			else	if (A[i]<	15901)A[i] = 153;
			else	if (A[i]<	16033)A[i] = 154;
			else	if (A[i]<	16333)A[i] = 155;
			else	if (A[i]<	16381)A[i] = 156;
			else	if (A[i]<	16417)A[i] = 157;
			else	if (A[i]<	16573)A[i] = 158;
			else	if (A[i]<	16633)A[i] = 159;
			else	if (A[i]<	16657)A[i] = 160;
			else	if (A[i]<	16921)A[i] = 161;
			else	if (A[i]<	17041)A[i] = 162;
			else	if (A[i]<	17053)A[i] = 163;
			else	if (A[i]<	17077)A[i] = 164;
			else	if (A[i]<	17257)A[i] = 165;
			else	if (A[i]<	17293)A[i] = 166;
			else	if (A[i]<	17377)A[i] = 167;
			else	if (A[i]<	17881)A[i] = 168;
			else	if (A[i]<	18013)A[i] = 169;
			else	if (A[i]<	18097)A[i] = 170;
			else	if (A[i]<	18133)A[i] = 171;
			else	if (A[i]<	18181)A[i] = 172;
			else	if (A[i]<	18217)A[i] = 173;
			else	if (A[i]<	18253)A[i] = 174;
			else	if (A[i]<	18301)A[i] = 175;
			else	if (A[i]<	18313)A[i] = 176;
			else	if (A[i]<	18397)A[i] = 177;
			else	if (A[i]<	18481)A[i] = 178;
			else	if (A[i]<	18553)A[i] = 179;
			else	if (A[i]<	18637)A[i] = 180;
			else	if (A[i]<	18793)A[i] = 181;
			else	if (A[i]<	19237)A[i] = 182;
			else	if (A[i]<	19441)A[i] = 183;
			else	if (A[i]<	19477)A[i] = 184;
			else	if (A[i]<	19717)A[i] = 185;
			else	if (A[i]<	19801)A[i] = 186;
			else	if (A[i]<	19813)A[i] = 187;
			else	if (A[i]<	19861)A[i] = 188;
			else	if (A[i]<	20353)A[i] = 189;
			else	if (A[i]<	20533)A[i] = 190;
			else	if (A[i]<	20641)A[i] = 191;
			else	if (A[i]<	20857)A[i] = 192;
			else	if (A[i]<	21001)A[i] = 193;
			else	if (A[i]<	21061)A[i] = 194;
			else	if (A[i]<	21193)A[i] = 195;
			else	if (A[i]<	21277)A[i] = 196;
			else	if (A[i]<	21313)A[i] = 197;
			else	if (A[i]<	21577)A[i] = 198;
			else	if (A[i]<	21661)A[i] = 199;
			else	if (A[i]<	21673)A[i] = 200;
			else	if (A[i]<	21817)A[i] = 201;
			else	if (A[i]<	22093)A[i] = 202;
			else	if (A[i]<	22501)A[i] = 203;
			else	if (A[i]<	22573)A[i] = 204;
			else	if (A[i]<	22621)A[i] = 205;
			else	if (A[i]<	22993)A[i] = 206;
			else	if (A[i]<	23053)A[i] = 207;
			else	if (A[i]<	23173)A[i] = 208;
			else	if (A[i]<	23557)A[i] = 209;
			else	if (A[i]<	23677)A[i] = 210;
			else	if (A[i]<	23773)A[i] = 211;
			else	if (A[i]<	23917)A[i] = 212;
			else	if (A[i]<	24097)A[i] = 213;
			else	if (A[i]<	24421)A[i] = 214;
			else	if (A[i]<	24481)A[i] = 215;
			else	if (A[i]<	24781)A[i] = 216;
			else	if (A[i]<	24841)A[i] = 217;
			else	if (A[i]<	25033)A[i] = 218;
			else	if (A[i]<	25153)A[i] = 219;
			else	if (A[i]<	25237)A[i] = 220;
			else	if (A[i]<	25561)A[i] = 221;
			else	if (A[i]<	25657)A[i] = 222;
			else	if (A[i]<	25933)A[i] = 223;
			else	if (A[i]<	26017)A[i] = 224;
			else	if (A[i]<	26293)A[i] = 225;
			else	if (A[i]<	26317)A[i] = 226;
			else	if (A[i]<	26437)A[i] = 227;
			else	if (A[i]<	26497)A[i] = 228;
			else	if (A[i]<	26821)A[i] = 229;
			else	if (A[i]<	26833)A[i] = 230;
			else	if (A[i]<	26881)A[i] = 231;
			else	if (A[i]<	26953)A[i] = 232;
			else	if (A[i]<	27073)A[i] = 233;
			else	if (A[i]<	27253)A[i] = 234;
			else	if (A[i]<	27337)A[i] = 235;
			else	if (A[i]<	27361)A[i] = 236;
			else	if (A[i]<	27457)A[i] = 237;
			else	if (A[i]<	27997)A[i] = 238;
			else	if (A[i]<	28057)A[i] = 239;
			else	if (A[i]<	28297)A[i] = 240;
			else	if (A[i]<	28393)A[i] = 241;
			else	if (A[i]<	28813)A[i] = 242;
			else	if (A[i]<	28837)A[i] = 243;
			else	if (A[i]<	28921)A[i] = 244;
			else	if (A[i]<	29101)A[i] = 245;
			else	if (A[i]<	29473)A[i] = 246;
			else	if (A[i]<	29641)A[i] = 247;
			else	if (A[i]<	30181)A[i] = 248;
			else	if (A[i]<	30241)A[i] = 249;
			else	if (A[i]<	30517)A[i] = 250;
			else	if (A[i]<	30553)A[i] = 251;
			else	if (A[i]<	30577)A[i] = 252;
			else	if (A[i]<	30637)A[i] = 253;
			else	if (A[i]<	30661)A[i] = 254;
			else	if (A[i]<	30697)A[i] = 255;
			else	if (A[i]<	30781)A[i] = 256;
			else	if (A[i]<	30853)A[i] = 257;
			else	if (A[i]<	31081)A[i] = 258;
			else	if (A[i]<	31237)A[i] = 259;
			else	if (A[i]<	31321)A[i] = 260;
			else	if (A[i]<	31333)A[i] = 261;
			else	if (A[i]<	31357)A[i] = 262;
			else	if (A[i]<	31477)A[i] = 263;
			else	if (A[i]<	31573)A[i] = 264;
			else	if (A[i]<	31873)A[i] = 265;
			else	if (A[i]<	31981)A[i] = 266;
			else	if (A[i]<	32173)A[i] = 267;
			else	if (A[i]<	32377)A[i] = 268;
			else	if (A[i]<	32497)A[i] = 269;
			else	if (A[i]<	32533)A[i] = 270;
			else	if (A[i]<	32833)A[i] = 271;
			else	if (A[i]<	33037)A[i] = 272;
			else	if (A[i]<	33301)A[i] = 273;
			else	if (A[i]<	33457)A[i] = 274;
			else	if (A[i]<	33493)A[i] = 275;
			else	if (A[i]<	33757)A[i] = 276;
			else	if (A[i]<	33961)A[i] = 277;
			else	if (A[i]<	34057)A[i] = 278;
			else	if (A[i]<	34213)A[i] = 279;
			else	if (A[i]<	34273)A[i] = 280;
			else	if (A[i]<	34381)A[i] = 281;
			else	if (A[i]<	34513)A[i] = 282;
			else	if (A[i]<	34897)A[i] = 283;
			else	if (A[i]<	34981)A[i] = 284;
			else	if (A[i]<	35317)A[i] = 285;
			else	if (A[i]<	35521)A[i] = 286;
			else	if (A[i]<	35677)A[i] = 287;
			else	if (A[i]<	35977)A[i] = 288;
			else	if (A[i]<	36097)A[i] = 289;
			else	if (A[i]<	36241)A[i] = 290;
			else	if (A[i]<	36433)A[i] = 291;
			else	if (A[i]<	36457)A[i] = 292;
			else	if (A[i]<	36793)A[i] = 293;
			else	if (A[i]<	36877)A[i] = 294;
			else	if (A[i]<	36901)A[i] = 295;
			else	if (A[i]<	36913)A[i] = 296;
			else	if (A[i]<	37273)A[i] = 297;
			else	if (A[i]<	37321)A[i] = 298;
			else	if (A[i]<	37357)A[i] = 299;
			else	if (A[i]<	37573)A[i] = 300;
			else	if (A[i]<	37717)A[i] = 301;
			else	if (A[i]<	37957)A[i] = 302;
			else	if (A[i]<	38281)A[i] = 303;
			else	if (A[i]<	38461)A[i] = 304;
			else	if (A[i]<	38833)A[i] = 305;
			else	if (A[i]<	38953)A[i] = 306;
			else	if (A[i]<	38977)A[i] = 307;
			else	if (A[i]<	39217)A[i] = 308;
			else	if (A[i]<	39373)A[i] = 309;
			else	if (A[i]<	39397)A[i] = 310;
			else	if (A[i]<	39733)A[i] = 311;
			else	if (A[i]<	40093)A[i] = 312;
			else	if (A[i]<	40177)A[i] = 313;
			else	if (A[i]<	40213)A[i] = 314;
			else	if (A[i]<	40693)A[i] = 315;
			else	if (A[i]<	40813)A[i] = 316;
			else	if (A[i]<	41017)A[i] = 317;
			else	if (A[i]<	41221)A[i] = 318;
			else	if (A[i]<	41281)A[i] = 319;
			else	if (A[i]<	41413)A[i] = 320;
			else	if (A[i]<	41617)A[i] = 321;
			else	if (A[i]<	41893)A[i] = 322;
			else	if (A[i]<	42061)A[i] = 323;
			else	if (A[i]<	42337)A[i] = 324;
			else	if (A[i]<	42373)A[i] = 325;
			else	if (A[i]<	42793)A[i] = 326;
			else	if (A[i]<	42961)A[i] = 327;
			else	if (A[i]<	43117)A[i] = 328;
			else	if (A[i]<	43177)A[i] = 329;
			else	if (A[i]<	43201)A[i] = 330;
			else	if (A[i]<	43321)A[i] = 331;
			else	if (A[i]<	43573)A[i] = 332;
			else	if (A[i]<	43597)A[i] = 333;
			else	if (A[i]<	43633)A[i] = 334;
			else	if (A[i]<	43717)A[i] = 335;
			else	if (A[i]<	44053)A[i] = 336;
			else	if (A[i]<	44101)A[i] = 337;
			else	if (A[i]<	44221)A[i] = 338;
			else	if (A[i]<	44257)A[i] = 339;
			else	if (A[i]<	44293)A[i] = 340;
			else	if (A[i]<	44893)A[i] = 341;
			else	if (A[i]<	45061)A[i] = 342;
			else	if (A[i]<	45337)A[i] = 343;
			else	if (A[i]<	45433)A[i] = 344;
			else	if (A[i]<	45481)A[i] = 345;
			else	if (A[i]<	45553)A[i] = 346;
			else	if (A[i]<	45613)A[i] = 347;
			else	if (A[i]<	45841)A[i] = 348;
			else	if (A[i]<	46021)A[i] = 349;
			else	if (A[i]<	46141)A[i] = 350;
			else	if (A[i]<	46261)A[i] = 351;
			else	if (A[i]<	46861)A[i] = 352;
			else	if (A[i]<	46993)A[i] = 353;
			else	if (A[i]<	47017)A[i] = 354;
			else	if (A[i]<	47161)A[i] = 355;
			else	if (A[i]<	47353)A[i] = 356;
			else	if (A[i]<	47521)A[i] = 357;
			else	if (A[i]<	47533)A[i] = 358;
			else	if (A[i]<	47653)A[i] = 359;
			else	if (A[i]<	47713)A[i] = 360;
			else	if (A[i]<	47737)A[i] = 361;
			else	if (A[i]<	47797)A[i] = 362;
			else	if (A[i]<	47857)A[i] = 363;
			else	if (A[i]<	48121)A[i] = 364;
			else	if (A[i]<	48193)A[i] = 365;
			else	if (A[i]<	48337)A[i] = 366;
			else	if (A[i]<	48673)A[i] = 367;
			else	if (A[i]<	48757)A[i] = 368;
			else	if (A[i]<	48781)A[i] = 369;
			else	if (A[i]<	49033)A[i] = 370;
			else	if (A[i]<	49261)A[i] = 371;
			else	if (A[i]<	49393)A[i] = 372;
			else	if (A[i]<	49417)A[i] = 373;
			else	if (A[i]<	49597)A[i] = 374;
			else	if (A[i]<	49681)A[i] = 375;
			else	if (A[i]<	49957)A[i] = 376;
			else	if (A[i]<	50221)A[i] = 377;
			else	if (A[i]<	50341)A[i] = 378;
			else	if (A[i]<	50377)A[i] = 379;
			else	if (A[i]<	50821)A[i] = 380;
			else	if (A[i]<	50893)A[i] = 381;
			else	if (A[i]<	51157)A[i] = 382;
			else	if (A[i]<	51217)A[i] = 383;
			else	if (A[i]<	51241)A[i] = 384;
			else	if (A[i]<	51481)A[i] = 385;
			else	if (A[i]<	51517)A[i] = 386;
			else	if (A[i]<	51637)A[i] = 387;
			else	if (A[i]<	52057)A[i] = 388;
			else	if (A[i]<	52081)A[i] = 389;
			else	if (A[i]<	52237)A[i] = 390;
			else	if (A[i]<	52321)A[i] = 391;
			else	if (A[i]<	52453)A[i] = 392;
			else	if (A[i]<	52501)A[i] = 393;
			else	if (A[i]<	52813)A[i] = 394;
			else	if (A[i]<	52861)A[i] = 395;
			else	if (A[i]<	52957)A[i] = 396;
			else	if (A[i]<	53077)A[i] = 397;
			else	if (A[i]<	53113)A[i] = 398;
			else	if (A[i]<	53281)A[i] = 399;
			else	if (A[i]<	53401)A[i] = 400;
			else	if (A[i]<	53917)A[i] = 401;
			else	if (A[i]<	54121)A[i] = 402;
			else	if (A[i]<	54133)A[i] = 403;
			else	if (A[i]<	54181)A[i] = 404;
			else	if (A[i]<	54217)A[i] = 405;
			else	if (A[i]<	54421)A[i] = 406;
			else	if (A[i]<	54517)A[i] = 407;
			else	if (A[i]<	54541)A[i] = 408;
			else	if (A[i]<	54673)A[i] = 409;
			else	if (A[i]<	54721)A[i] = 410;
			else	if (A[i]<	54973)A[i] = 411;
			else	if (A[i]<	55057)A[i] = 412;
			else	if (A[i]<	55381)A[i] = 413;
			else	if (A[i]<	55501)A[i] = 414;
			else	if (A[i]<	55633)A[i] = 415;
			else	if (A[i]<	55837)A[i] = 416;
			else	if (A[i]<	55921)A[i] = 417;
			else	if (A[i]<	55933)A[i] = 418;
			else	if (A[i]<	56053)A[i] = 419;
			else	if (A[i]<	56101)A[i] = 420;
			else	if (A[i]<	56113)A[i] = 421;
			else	if (A[i]<	56197)A[i] = 422;
			else	if (A[i]<	56401)A[i] = 423;
			else	if (A[i]<	56437)A[i] = 424;
			else	if (A[i]<	56701)A[i] = 425;
			else	if (A[i]<	56773)A[i] = 426;
			else	if (A[i]<	56821)A[i] = 427;
			else	if (A[i]<	56857)A[i] = 428;
			else	if (A[i]<	56893)A[i] = 429;
			else	if (A[i]<	57073)A[i] = 430;
			else	if (A[i]<	57097)A[i] = 431;
			else	if (A[i]<	57193)A[i] = 432;
			else	if (A[i]<	57241)A[i] = 433;
			else	if (A[i]<	57373)A[i] = 434;
			else	if (A[i]<	57457)A[i] = 435;
			else	if (A[i]<	57853)A[i] = 436;
			else	if (A[i]<	58153)A[i] = 437;
			else	if (A[i]<	58417)A[i] = 438;
			else	if (A[i]<	58441)A[i] = 439;
			else	if (A[i]<	58537)A[i] = 440;
			else	if (A[i]<	58573)A[i] = 441;
			else	if (A[i]<	58693)A[i] = 442;
			else	if (A[i]<	59053)A[i] = 443;
			else	if (A[i]<	59197)A[i] = 444;
			else	if (A[i]<	59221)A[i] = 445;
			else	if (A[i]<	59281)A[i] = 446;
			else	if (A[i]<	59341)A[i] = 447;
			else	if (A[i]<	59833)A[i] = 448;
			else	if (A[i]<	60217)A[i] = 449;
			else	if (A[i]<	60337)A[i] = 450;
			else	if (A[i]<	60373)A[i] = 451;
			else	if (A[i]<	60637)A[i] = 452;
			else	if (A[i]<	60733)A[i] = 453;
			else	if (A[i]<	60937)A[i] = 454;
			else	if (A[i]<	61057)A[i] = 455;
			else	if (A[i]<	61153)A[i] = 456;
			else	if (A[i]<	61261)A[i] = 457;
			else	if (A[i]<	61297)A[i] = 458;
			else	if (A[i]<	61561)A[i] = 459;
			else	if (A[i]<	61657)A[i] = 460;
			else	if (A[i]<	61681)A[i] = 461;
			else	if (A[i]<	61717)A[i] = 462;
			else	if (A[i]<	61861)A[i] = 463;
			else	if (A[i]<	62137)A[i] = 464;
			else	if (A[i]<	62473)A[i] = 465;
			else	if (A[i]<	62497)A[i] = 466;
			else	if (A[i]<	62533)A[i] = 467;
			else	if (A[i]<	62653)A[i] = 468;
			else	if (A[i]<	62773)A[i] = 469;
			else	if (A[i]<	63313)A[i] = 470;
			else	if (A[i]<	63397)A[i] = 471;
			else	if (A[i]<	63541)A[i] = 472;
			else	if (A[i]<	63697)A[i] = 473;
			else	if (A[i]<	63781)A[i] = 474;
			else	if (A[i]<	63913)A[i] = 475;
			else	if (A[i]<	64153)A[i] = 476;
			else	if (A[i]<	64237)A[i] = 477;
			else	if (A[i]<	64381)A[i] = 478;
			else	if (A[i]<	64513)A[i] = 479;
			else	if (A[i]<	64717)A[i] = 480;
			else	if (A[i]<	65173)A[i] = 481;
			else	if (A[i]<	65293)A[i] = 482;
			else	if (A[i]<	65413)A[i] = 483;
			else	if (A[i]<	65437)A[i] = 484;
			else	if (A[i]<	65497)A[i] = 485;
			else	if (A[i]<	65557)A[i] = 486;
			else	if (A[i]<	65677)A[i] = 487;
			else	if (A[i]<	65881)A[i] = 488;
			else	if (A[i]<	66301)A[i] = 489;
			else	if (A[i]<	66361)A[i] = 490;
			else	if (A[i]<	66601)A[i] = 491;
			else	if (A[i]<	66697)A[i] = 492;
			else	if (A[i]<	66853)A[i] = 493;
			else	if (A[i]<	66973)A[i] = 494;
			else	if (A[i]<	67057)A[i] = 495;
			else	if (A[i]<	67153)A[i] = 496;
			else	if (A[i]<	67273)A[i] = 497;
			else	if (A[i]<	67477)A[i] = 498;
			else	if (A[i]<	67537)A[i] = 499;
			else	if (A[i]<	67741)A[i] = 500;
			else	if (A[i]<	67777)A[i] = 501;
			else	if (A[i]<	67933)A[i] = 502;
			else	if (A[i]<	67993)A[i] = 503;
			else	if (A[i]<	68113)A[i] = 504;
			else	if (A[i]<	68281)A[i] = 505;
			else	if (A[i]<	68521)A[i] = 506;
			else	if (A[i]<	68737)A[i] = 507;
			else	if (A[i]<	69001)A[i] = 508;
			else	if (A[i]<	69073)A[i] = 509;
			else	if (A[i]<	69457)A[i] = 510;
			else	if (A[i]<	69493)A[i] = 511;
			else	if (A[i]<	69697)A[i] = 512;
			else	if (A[i]<	69877)A[i] = 513;
			else	if (A[i]<	70117)A[i] = 514;
			else	if (A[i]<	70177)A[i] = 515;
			else	if (A[i]<	70297)A[i] = 516;
			else	if (A[i]<	70501)A[i] = 517;
			else	if (A[i]<	70621)A[i] = 518;
			else	if (A[i]<	70921)A[i] = 519;
			else	if (A[i]<	70981)A[i] = 520;
			else	if (A[i]<	71233)A[i] = 521;
			else	if (A[i]<	71341)A[i] = 522;
			else	if (A[i]<	71353)A[i] = 523;
			else	if (A[i]<	71593)A[i] = 524;
			else	if (A[i]<	71821)A[i] = 525;
			else	if (A[i]<	72073)A[i] = 526;
			else	if (A[i]<	72481)A[i] = 527;
			else	if (A[i]<	72613)A[i] = 528;
			else	if (A[i]<	72901)A[i] = 529;
			else	if (A[i]<	72937)A[i] = 530;
			else	if (A[i]<	73141)A[i] = 531;
			else	if (A[i]<	73417)A[i] = 532;
			else	if (A[i]<	73477)A[i] = 533;
			else	if (A[i]<	73561)A[i] = 534;
			else	if (A[i]<	73693)A[i] = 535;
			else	if (A[i]<	74077)A[i] = 536;
			else	if (A[i]<	74317)A[i] = 537;
			else	if (A[i]<	74377)A[i] = 538;
			else	if (A[i]<	74713)A[i] = 539;
			else	if (A[i]<	75013)A[i] = 540;
			else	if (A[i]<	75133)A[i] = 541;
			else	if (A[i]<	75181)A[i] = 542;
			else	if (A[i]<	75721)A[i] = 543;
			else	if (A[i]<	75793)A[i] = 544;
			else	if (A[i]<	75913)A[i] = 545;
			else	if (A[i]<	76333)A[i] = 546;
			else	if (A[i]<	76561)A[i] = 547;
			else	if (A[i]<	76597)A[i] = 548;
			else	if (A[i]<	76753)A[i] = 549;
			else	if (A[i]<	77137)A[i] = 550;
			else	if (A[i]<	77641)A[i] = 551;
			else	if (A[i]<	78157)A[i] = 552;
			else	if (A[i]<	78193)A[i] = 553;
			else	if (A[i]<	78277)A[i] = 554;
			else	if (A[i]<	78877)A[i] = 555;
			else	if (A[i]<	78901)A[i] = 556;
			else	if (A[i]<	79333)A[i] = 557;
			else	if (A[i]<	79357)A[i] = 558;
			else	if (A[i]<	79537)A[i] = 559;
			else	if (A[i]<	79657)A[i] = 560;
			else	if (A[i]<	79693)A[i] = 561;
			else	if (A[i]<	79801)A[i] = 562;
			else	if (A[i]<	79873)A[i] = 563;
			else	if (A[i]<	80077)A[i] = 564;
			else	if (A[i]<	80173)A[i] = 565;
			else	if (A[i]<	80221)A[i] = 566;
			else	if (A[i]<	80473)A[i] = 567;
			else	if (A[i]<	80701)A[i] = 568;
			else	if (A[i]<	80713)A[i] = 569;
			else	if (A[i]<	80917)A[i] = 570;
			else	if (A[i]<	81013)A[i] = 571;
			else	if (A[i]<	81181)A[i] = 572;
			else	if (A[i]<	81517)A[i] = 573;
			else	if (A[i]<	81637)A[i] = 574;
			else	if (A[i]<	81853)A[i] = 575;
			else	if (A[i]<	82021)A[i] = 576;
			else	if (A[i]<	82153)A[i] = 577;
			else	if (A[i]<	82261)A[i] = 578;
			else	if (A[i]<	82561)A[i] = 579;
			else	if (A[i]<	82981)A[i] = 580;
			else	if (A[i]<	83077)A[i] = 581;
			else	if (A[i]<	83221)A[i] = 582;
			else	if (A[i]<	83233)A[i] = 583;
			else	if (A[i]<	83437)A[i] = 584;
			else	if (A[i]<	83617)A[i] = 585;
			else	if (A[i]<	83701)A[i] = 586;
			else	if (A[i]<	83773)A[i] = 587;
			else	if (A[i]<	84121)A[i] = 588;
			else	if (A[i]<	84313)A[i] = 589;
			else	if (A[i]<	84673)A[i] = 590;
			else	if (A[i]<	84697)A[i] = 591;
			else	if (A[i]<	84793)A[i] = 592;
			else	if (A[i]<	84913)A[i] = 593;
			else	if (A[i]<	85297)A[i] = 594;
			else	if (A[i]<	85333)A[i] = 595;
			else	if (A[i]<	85453)A[i] = 596;
			else	if (A[i]<	85717)A[i] = 597;
			else	if (A[i]<	85933)A[i] = 598;
			else	if (A[i]<	86353)A[i] = 599;
			else	if (A[i]<	86413)A[i] = 600;
			else	if (A[i]<	87181)A[i] = 601;
			else	if (A[i]<	87253)A[i] = 602;
			else	if (A[i]<	87337)A[i] = 603;
			else	if (A[i]<	87421)A[i] = 604;
			else	if (A[i]<	87433)A[i] = 605;
			else	if (A[i]<	87517)A[i] = 606;
			else	if (A[i]<	87553)A[i] = 607;
			else	if (A[i]<	87973)A[i] = 608;
			else	if (A[i]<	88117)A[i] = 609;
			else	if (A[i]<	88177)A[i] = 610;
			else	if (A[i]<	88237)A[i] = 611;
			else	if (A[i]<	88261)A[i] = 612;
			else	if (A[i]<	88513)A[i] = 613;
			else	if (A[i]<	88741)A[i] = 614;
			else	if (A[i]<	88897)A[i] = 615;
			else	if (A[i]<	88993)A[i] = 616;
			else	if (A[i]<	89293)A[i] = 617;
			else	if (A[i]<	89833)A[i] = 618;
			else	if (A[i]<	89917)A[i] = 619;
			else	if (A[i]<	90121)A[i] = 620;
			else	if (A[i]<	91081)A[i] = 621;
			else	if (A[i]<	91381)A[i] = 622;
			else	if (A[i]<	91393)A[i] = 623;
			else	if (A[i]<	91513)A[i] = 624;
			else	if (A[i]<	91957)A[i] = 625;
			else	if (A[i]<	92041)A[i] = 626;
			else	if (A[i]<	92557)A[i] = 627;
			else	if (A[i]<	92761)A[i] = 628;
			else	if (A[i]<	92821)A[i] = 629;
			else	if (A[i]<	92893)A[i] = 630;
			else	if (A[i]<	92941)A[i] = 631;
			else	if (A[i]<	93097)A[i] = 632;
			else	if (A[i]<	93133)A[i] = 633;
			else	if (A[i]<	93493)A[i] = 634;
			else	if (A[i]<	93637)A[i] = 635;
			else	if (A[i]<	93913)A[i] = 636;
			else	if (A[i]<	94033)A[i] = 637;
			else	if (A[i]<	94117)A[i] = 638;
			else	if (A[i]<	94273)A[i] = 639;
			else	if (A[i]<	94321)A[i] = 640;
			else	if (A[i]<	94441)A[i] = 641;
			else	if (A[i]<	94573)A[i] = 642;
			else	if (A[i]<	94777)A[i] = 643;
			else	if (A[i]<	94837)A[i] = 644;
			else if (A[i]<	94993)A[i] = 645;
			else if (A[i]<	95257)A[i] = 646;
			else if (A[i]<	95317)A[i] = 647;
			else if (A[i]<	95401)A[i] = 648;
			else if (A[i]<	95581)A[i] = 649;
			else if (A[i]<	95617)A[i] = 650;
			else if (A[i]<	95713)A[i] = 651;
			else if (A[i]<	95737)A[i] = 652;
			else if (A[i]<	96097)A[i] = 653;
			else if (A[i]<	96157)A[i] = 654;
			else if (A[i]<	96181)A[i] = 655;
			else if (A[i]<	96493)A[i] = 656;
			else if (A[i]<	96517)A[i] = 657;
			else if (A[i]<	96973)A[i] = 658;
			else if (A[i]<	97081)A[i] = 659;
			else if (A[i]<	97177)A[i] = 660;
			else if (A[i]<	97501)A[i] = 661;
			else if (A[i]<	97561)A[i] = 662;
			else if (A[i]<	97777)A[i] = 663;
			else if (A[i]<	97813)A[i] = 664;
			else if (A[i]<	98017)A[i] = 665;
			else if (A[i]<	98737)A[i] = 666;
			else if (A[i]<	98953)A[i] = 667;
			else if (A[i]<	99277)A[i] = 668;
			else if (A[i]<	99577)A[i] = 669;
			else if (A[i]<	99661)A[i] = 670;
			else if (A[i]<	99877)A[i] = 671;
			else A[i] = 672;
		}
		cout << A[1] - A[0] << endl;
	}
	return 0;
}


Measured memory_bytes: 640