xv=[9, 11, 10, 11, 11, 10, 11, 8, 8, 9, 9, 7, 4, 4, 4, 6, 7, 7, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 1, 1, 1, 1, 1, 29, 30, 30, 34, 34, 35, 34, 35, 36, 36, 37, 37, 37, 37, 37, 39, 40, 39, 37, 36, 36, 36, 36, 34, 33, 31, 31, 30, 29, 28, 28, 27, 26, 26, 26, 26, 26, 25, 25, 23, 22, 22, 22, 23, 23, 24, 26, 27, 27, 27, 29, 32, 32, 32, 35, 36, 39, 41, 42, 45, 45, 47, 51, 53, 54, 55, 59, 59, 60, 61, 62, 65, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 72, 74, 75, 75, 76, 76, 77, 78, 78, 80, 82, 82, 83, 84, 86, 88, 90, 91, 92, 94, 95, 98, 99, 99, 101, 102, 106, 106, 107, 107, 109, 109, 110, 111, 112, 114, 114, 114, 114, 113, 113, 114, 114, 114, 113, 112, 111, 111, 111, 109, 108, 107, 107, 107, 109, 109, 109, 108, 107, 107, 108, 107, 108, 108, 107, 108, 108, 110, 111, 115, 116, 117, 118, 119, 123, 123, 124, 126, 128, 129, 131, 132, 133, 135, 137, 139, 140, 141, 142, 142, 144, 145, 146, 147, 147, 149, 149, 150, 150, 150, 151, 151, 152, 155, 154, 155, 156, 156, 157, 157, 158, 158, 159, 162, 162, 163, 164, 165, 168, 169, 170, 171, 171, 173, 175, 175, 178, 179, 181, 180, 181, 182, 182, 185, 185, 186, 186, 186, 186, 187, 186, 186, 185, 185, 185, 184, 182, 181, 180, 180, 179, 179, 178, 178, 178, 178, 178, 178, 178, 178, 177, 178, 178, 178, 179, 179, 179, 179, 181, 184, 184, 185, 187, 189, 190, 191, 192, 195, 196, 197, 198, 199, 202, 203, 205, 206, 208, 208, 210, 210, 211, 212, 213, 215, 215, 216, 217, 218, 218, 219, 220, 220, 220, 221, 222, 222, 224, 225, 226, 227, 227, 228, 228, 229, 231, 233, 235, 236, 236, 239, 240, 242, 244, 245, 250, 251, 252, 253, 254, 254, 254, 255, 258, 259, 260, 260, 260, 260, 261, 260, 259, 258, 258, 258, 258, 258, 258, 257, 257, 254, 253, 253, 253, 254, 253, 252, 251, 251, 252, 251, 251, 251, 251, 251, 252, 253, 253, 254, 255, 257, 259, 259, 260, 261, 263, 264, 267, 268, 269, 272, 273, 275, 277, 277, 280, 280, 281, 282, 283, 284, 285, 287, 288, 289, 290, 291, 291, 291, 291, 291, 291, 291, 292, 293, 294, 296, 298, 299, 299, 299, 301, 302, 305, 307, 307, 308, 309, 312, 314, 315, 316, 317, 320, 322, 323, 324, 325, 327, 328, 329, 331, 331, 331, 332, 333, 333, 336, 337, 337, 337, 338, 338, 337, 337, 338, 337, 337, 338, 336, 334, 333, 333, 333, 333, 332, 332, 331, 331, 330, 330, 331, 332, 332, 333, 333, 334, 335, 336, 338, 340, 341, 343, 344, 345, 347, 348, 349, 349, 353, 354, 356, 357, 358, 359, 361, 363, 365, 365, 366, 368, 370, 372, 373, 373, 374, 376, 378, 379, 379, 379, 379, 380, 382, 383, 383, 383, 384, 386, 387, 388, 388, 388, 388, 388, 388, 387, 386, 385, 385, 386, 386, 387, 388, 388, 390, 391, 393, 394, 395, 394, 395, 396, 396, 396, 395, 396, 396, 396, 395, 395, 395, 394, 394, 393, 392, 391, 391, 390, 388, 387, 387, 386, 386, 386, 385, 386, 387, 387, 387, 387, 387, 388, 389, 390, 391, 391, 394, 395, 396, 396, 398, 402, 403, 406, 408, 411, 413, 415, 418, 419, 421, 423, 426, 428, 430, 431, 433, 435, 436, 439, 441, 442, 443, 443, 444, 445, 445, 447, 449, 450, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 452, 452, 452, 452, 452, 453, 453, 455, 456, 458, 458, 459, 459, 459, 459, 460, 460, 461, 462, 461, 462, 462, 462, 462, 463, 463, 463, 463, 462, 461, 460, 459, 458, 458, 457, 456, 456, 455, 454, 453, 452, 451, 450, 450, 450, 451, 451, 451, 451, 452, 454, 455, 456, 458, 458, 459, 460, 460, 461, 461, 465, 466, 468, 471, 475, 477, 479, 482, 484, 485, 486, 489, 491, 493, 497, 499, 500, 502, 506, 506, 507, 508, 509, 511, 512, 513, 513, 515, 516, 517, 517, 517, 516, 516, 516, 518, 519, 520, 521, 522, 523, 523, 524, 524, 524, 524, 524, 527, 527, 528, 529, 529, 530, 531, 533, 533, 533, 533, 533, 533, 534, 533, 533, 533, 533, 533, 532, 531, 531, 529, 529, 528, 527, 527, 527, 526, 525, 524, 524, 523, 523, 523, 522, 521, 521, 521, 522, 521, 520, 521, 522, 523, 524, 524, 525, 526, 527, 529, 530, 530, 533, 533, 538, 542, 545, 548, 549, 551, 552, 554, 556, 556, 560, 560, 563, 565, 566, 567, 568, 570, 571, 572, 572, 574, 575, 576, 578, 578, 579, 579, 579, 579, 580, 580, 580, 580, 580, 580, 581, 583, 583, 584, 583, 583, 583, 584, 584, 586, 586, 588, 588, 588, 588, 589, 588, 588, 589, 588, 589, 589, 590, 590, 590, 591, 590, 590, 591, 591, 591, 590, 589, 588, 588, 588, 589, 588, 587, 586, 584, 583, 583, 582, 582, 582, 582, 581, 581, 582, 583, 583, 585, 586, 587, 587, 588, 590, 591, 594, 594, 595, 597, 600, 603, 604, 606, 610, 611, 614, 616, 618, 619, 620, 623, 626, 628, 629, 629, 633, 634, 635, 636, 637, 638, 641, 642, 643, 644, 644, 645, 646, 647, 647, 647, 648, 648, 648, 648, 649, 649, 650, 651, 651, 652, 652, 652, 652, 653, 653, 654, 655, 656, 657, 659, 659, 660, 661, 662, 663, 664, 663, 663, 664, 664, 665, 665, 666, 666, 665, 664, 663, 662, 661, 661, 661, 660, 659, 659, 658, 657, 657, 654, 653, 653, 653, 652, 653, 652, 653, 653, 654, 655, 656, 657, 657, 658, 659, 659, 660, 661, 662, 664, 667, 669, 670, 675, 676, 679, 681, 682, 684, 684, 688, 689, 691, 694, 697, 698, 699, 700, 701, 703, 706, 708, 709, 710, 713, 714, 715, 716, 716, 716, 717, 717, 717, 719, 719, 720, 720, 722, 722, 723, 724, 725, 725, 725, 726, 726, 727, 727, 728, 730, 731, 732, 734, 735, 737, 738, 738, 738, 740, 740, 740, 742, 743, 744, 743, 744, 743, 742, 742, 742, 742, 742, 742, 742, 741, 741, 739, 739, 738, 737, 735, 735, 734, 735, 734, 734, 735, 734, 734, 735, 736, 737, 738, 738, 740, 740, 740, 742, 743, 745, 748, 752, 752, 757, 759, 762, 765, 766, 769, 771, 774, 777, 780, 781, 782, 785, 786, 788, 789, 791, 793, 794, 796, 796, 798, 799, 799, 801, 802, 803, 804, 804, 805, 804, 804, 804, 804, 805, 807, 808, 810, 811, 812, 813, 813, 814, 814, 814, 816, 817, 818, 819, 820, 821, 824, 825, 827, 827, 830, 830, 833, 838, 839, 840, 846, 847, 850, 852, 854, 856, 859, 863, 864, 864, 864, 864, 864, 862, 862, 862, 861, 861, 858, 858, 857, 856, 857, 856, 855, 854, 853, 853, 851, 850, 849, 848, 848, 846, 845, 845, 844, 845, 845, 845, 844, 845, 844, 844, 844, 844, 844, 844, 845, 846, 846, 846, 846, 846, 846, 848, 848, 848, 848, 848, 848, 848, 848, 848, 850, 851, 851, 851, 851, 852, 852, 855, 855, 856, 858, 860, 860, 861, 863, 864, 865, 867, 870, 870, 874, 876, 879, 882, 884, 887, 887, 892, 895, 896, 902, 904, 905, 907, 909, 910, 911, 911, 914, 916, 917, 918, 918, 918, 918, 919, 918, 919, 919, 918, 918, 916, 916, 915, 915, 914, 913, 913, 912, 911, 911, 911, 909, 910, 909, 908, 907, 907, 906, 906, 905, 906, 905, 906, 906, 906, 906, 906, 906, 906, 906, 907, 907, 908, 907, 907, 907, 907, 907, 908, 909, 910, 910, 910, 911, 911, 910, 910, 910, 911, 911, 912, 913, 913, 914, 914, 914, 915, 916, 918, 919, 920, 921, 921, 921, 922, 926, 926, 929, 931, 932, 935, 937, 938, 941, 946, 946, 951, 953, 955, 955, 959, 961, 963, 965, 966, 968, 971, 972, 973, 974, 975, 977, 978, 977, 977, 978, 978, 978, 977, 977, 977, 976, 976, 975, 975, 974, 973, 973, 971, 970, 969, 968, 967, 966, 966, 963, 963, 963, 963, 962, 962, 963, 962, 963, 962, 962, 962, 963, 964, 964, 963, 963, 963, 963, 964, 964, 965, 964, 966, 966, 965, 966, 967, 966, 967, 967, 967, 967, 967, 967, 969, 970, 970, 970, 970, 971, 973, 973, 975, 975, 976, 977, 979, 979, 979, 981, 983, 987, 988, 990, 993, 996, 997, 999, 1001, 1003, 1004];
yv=[398, 398, 396, 395, 395, 395, 394, 394, 394, 394, 394, 396, 395, 398, 396, 399, 395, 396, 394, 394, 397, 396, 397, 402, 402, 400, 399, 402, 400, 400, 399, 398, 396, 397, 399, 403, 400, 399, 399, 397, 401, 402, 401, 400, 401, 419, 423, 427, 430, 432, 435, 438, 442, 444, 445, 451, 453, 455, 461, 462, 463, 467, 468, 470, 472, 476, 476, 476, 477, 478, 483, 484, 484, 483, 484, 484, 484, 484, 483, 481, 481, 477, 475, 474, 473, 472, 471, 469, 465, 464, 459, 457, 455, 452, 449, 447, 441, 441, 440, 435, 433, 428, 426, 424, 421, 419, 418, 414, 411, 409, 407, 405, 404, 404, 401, 400, 398, 398, 397, 397, 396, 396, 395, 394, 394, 394, 395, 396, 396, 397, 397, 401, 401, 403, 404, 404, 405, 408, 410, 413, 415, 419, 421, 424, 426, 428, 433, 435, 439, 442, 444, 449, 451, 454, 456, 459, 462, 465, 465, 468, 473, 474, 477, 478, 481, 481, 485, 486, 486, 487, 489, 492, 492, 492, 493, 492, 492, 493, 492, 492, 491, 486, 485, 483, 483, 481, 479, 477, 476, 470, 469, 468, 465, 463, 460, 458, 452, 448, 446, 443, 441, 437, 434, 431, 428, 424, 422, 420, 417, 414, 410, 409, 406, 405, 402, 401, 400, 399, 399, 399, 397, 395, 394, 394, 394, 393, 394, 395, 395, 396, 397, 398, 400, 401, 402, 402, 405, 407, 410, 411, 415, 415, 417, 422, 424, 426, 430, 433, 437, 440, 443, 446, 448, 453, 455, 458, 461, 465, 466, 467, 471, 472, 477, 479, 480, 481, 484, 485, 487, 488, 488, 489, 490, 491, 493, 494, 493, 494, 493, 492, 492, 491, 489, 487, 486, 482, 481, 480, 478, 473, 473, 468, 468, 464, 463, 458, 455, 452, 449, 446, 442, 437, 434, 433, 428, 425, 422, 420, 419, 416, 415, 409, 408, 404, 403, 401, 401, 400, 399, 398, 396, 394, 394, 393, 392, 392, 392, 393, 393, 393, 393, 393, 394, 397, 399, 400, 401, 402, 406, 406, 408, 409, 413, 416, 418, 421, 424, 426, 428, 433, 434, 440, 446, 449, 450, 455, 457, 459, 462, 464, 465, 468, 470, 472, 473, 474, 476, 478, 480, 480, 481, 484, 485, 485, 485, 486, 486, 487, 486, 485, 482, 482, 480, 478, 477, 474, 472, 470, 469, 467, 464, 462, 458, 456, 450, 449, 448, 442, 440, 435, 433, 428, 426, 420, 417, 416, 413, 412, 408, 404, 402, 399, 399, 397, 395, 393, 392, 391, 389, 389, 388, 387, 385, 385, 385, 385, 385, 386, 386, 386, 388, 388, 389, 390, 391, 393, 393, 395, 397, 400, 402, 404, 407, 409, 413, 415, 418, 422, 423, 428, 430, 434, 437, 439, 444, 446, 450, 453, 453, 456, 459, 461, 464, 466, 468, 470, 470, 472, 473, 476, 477, 479, 479, 480, 480, 480, 481, 481, 480, 480, 479, 477, 476, 473, 472, 472, 471, 467, 465, 465, 462, 460, 456, 454, 450, 448, 444, 441, 437, 435, 433, 428, 426, 422, 420, 415, 413, 409, 408, 406, 404, 402, 400, 397, 396, 395, 394, 392, 390, 389, 388, 388, 386, 385, 383, 383, 384, 384, 384, 384, 384, 386, 387, 388, 390, 390, 391, 392, 394, 395, 395, 395, 395, 395, 396, 396, 397, 397, 400, 405, 408, 412, 413, 417, 423, 426, 429, 433, 435, 439, 441, 444, 447, 451, 454, 456, 458, 459, 462, 463, 465, 466, 468, 468, 469, 472, 473, 472, 472, 471, 471, 471, 470, 468, 465, 464, 463, 463, 460, 458, 456, 452, 451, 448, 445, 441, 440, 437, 434, 432, 428, 427, 423, 419, 418, 414, 413, 411, 410, 406, 404, 402, 401, 399, 397, 396, 393, 391, 390, 390, 389, 388, 387, 387, 387, 386, 385, 385, 385, 386, 388, 388, 389, 390, 392, 393, 395, 397, 398, 399, 403, 405, 407, 411, 413, 420, 421, 426, 428, 432, 435, 440, 442, 447, 447, 450, 453, 455, 460, 460, 464, 467, 470, 474, 475, 478, 479, 482, 485, 486, 488, 489, 491, 492, 492, 493, 494, 493, 493, 493, 492, 492, 490, 489, 487, 485, 484, 481, 478, 477, 476, 472, 470, 467, 465, 463, 460, 459, 453, 452, 448, 445, 441, 438, 437, 434, 431, 429, 428, 427, 426, 424, 421, 417, 416, 415, 413, 412, 410, 410, 409, 407, 407, 406, 406, 405, 404, 404, 404, 405, 407, 409, 410, 412, 412, 413, 414, 416, 418, 419, 421, 426, 429, 431, 433, 437, 440, 445, 447, 451, 454, 456, 461, 463, 465, 468, 472, 472, 476, 478, 482, 487, 487, 490, 493, 497, 497, 500, 502, 504, 506, 507, 508, 509, 509, 511, 512, 512, 511, 510, 510, 509, 508, 508, 504, 502, 501, 500, 497, 493, 491, 489, 487, 484, 483, 479, 477, 476, 470, 470, 465, 461, 459, 455, 453, 451, 450, 449, 446, 445, 443, 443, 438, 436, 435, 434, 432, 430, 429, 429, 428, 427, 426, 425, 424, 423, 422, 422, 423, 423, 425, 427, 428, 430, 431, 433, 435, 437, 437, 441, 444, 445, 446, 451, 455, 457, 459, 463, 466, 470, 472, 477, 480, 482, 487, 488, 492, 494, 499, 501, 503, 508, 509, 510, 513, 517, 517, 519, 523, 524, 526, 527, 529, 530, 531, 531, 532, 533, 533, 533, 532, 531, 529, 529, 526, 526, 524, 523, 521, 517, 514, 514, 512, 509, 508, 502, 501, 499, 494, 492, 489, 486, 484, 482, 479, 475, 474, 471, 470, 469, 467, 464, 460, 460, 459, 455, 455, 453, 452, 450, 450, 448, 447, 447, 446, 445, 445, 445, 445, 445, 445, 448, 449, 450, 451, 453, 454, 455, 457, 458, 461, 462, 464, 468, 470, 473, 476, 480, 482, 487, 490, 492, 495, 497, 502, 504, 507, 509, 512, 516, 519, 521, 524, 526, 528, 532, 533, 536, 540, 542, 542, 543, 546, 546, 547, 548, 549, 549, 550, 551, 551, 550, 550, 550, 548, 543, 543, 542, 539, 537, 533, 532, 530, 528, 525, 524, 521, 517, 517, 512, 509, 508, 502, 501, 497, 494, 493, 491, 489, 486, 485, 484, 479, 478, 477, 476, 475, 473, 471, 470, 468, 468, 467, 465, 464, 464, 463, 463, 463, 463, 463, 464, 467, 468, 469, 470, 471, 472, 472, 475, 477, 478, 481, 483, 487, 489, 492, 497, 500, 502, 508, 510, 512, 516, 519, 522, 522, 526, 529, 532, 535, 536, 537, 542, 545, 547, 550, 552, 554, 556, 558, 559, 560, 560, 561, 563, 564, 565, 566, 566, 566, 565, 564, 564, 562, 561, 559, 556, 555, 553, 551, 547, 546, 543, 542, 541, 536, 533, 531, 527, 522, 522, 517, 514, 512, 507, 505, 503, 501, 498, 496, 493, 492, 490, 488, 487, 483, 482, 480, 479, 478, 475, 475, 473, 472, 472, 472, 472, 471, 470, 470, 471, 472, 473, 474, 475, 478, 480, 480, 481, 484, 485, 487, 487, 487, 487, 487, 487, 486, 485, 485, 485, 485, 488, 490, 493, 493, 498, 500, 503, 508, 509, 511, 517, 521, 525, 529, 534, 537, 539, 544, 545, 545, 545, 546, 547, 549, 550, 550, 551, 551, 551, 552, 552, 551, 551, 549, 548, 546, 545, 544, 542, 539, 537, 534, 534, 530, 527, 524, 520, 519, 513, 511, 509, 504, 502, 499, 495, 493, 488, 485, 481, 480, 475, 473, 472, 471, 467, 465, 464, 462, 461, 461, 460, 459, 457, 456, 454, 454, 453, 453, 454, 454, 454, 454, 454, 454, 458, 460, 460, 460, 461, 462, 465, 467, 469, 470, 473, 474, 476, 479, 480, 483, 483, 488, 489, 490, 495, 497, 498, 501, 504, 505, 506, 507, 511, 513, 514, 516, 519, 520, 521, 522, 522, 525, 528, 528, 529, 530, 531, 531, 531, 530, 530, 531, 530, 529, 528, 526, 525, 524, 521, 519, 518, 516, 515, 510, 508, 505, 501, 499, 496, 493, 489, 487, 483, 477, 475, 469, 467, 463, 460, 459, 455, 452, 449, 447, 445, 442, 440, 437, 437, 436, 436, 436, 434, 432, 430, 429, 429, 429, 429, 429, 429, 429, 429, 429, 431, 432, 433, 433, 433, 433, 437, 439, 441, 441, 441, 446, 448, 449, 452, 454, 455, 459, 461, 464, 464, 468, 469, 472, 476, 476, 478, 482, 484, 485, 486, 488, 490, 492, 493, 494, 495, 496, 499, 500, 501, 502, 504, 505, 505, 505, 505, 505, 505, 505, 504, 503, 499, 498, 497, 497, 493, 493, 490, 488, 486, 483, 480, 476, 474, 469, 467, 462, 460, 458, 451, 448, 444, 443, 440, 436, 435, 430, 429, 424, 422, 420, 419, 416, 415, 414, 412, 412, 411, 409, 409, 408, 408, 407, 407, 407, 407, 408, 408, 408, 408, 409, 411, 412, 412, 413, 414, 416, 420, 420, 420, 422, 427, 428, 429, 431, 433, 436];
