File size: 333,355 Bytes
af7cfd1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 | problems
"Andi and Budi were given an assignment to tidy up their bookshelf of n books. Each book is represented by the book title β a string s_i numbered from 1 to n, each with length m. Andi really wants to sort the book lexicographically ascending, while Budi wants to sort it lexicographically descending.
Settling their fight, they decided to combine their idea and sort it asc-desc-endingly, where the odd-indexed characters will be compared ascendingly, and the even-indexed characters will be compared descendingly.
A string a occurs before a string b in asc-desc-ending order if and only if in the first position where a and b differ, the following holds:
* if it is an odd position, the string a has a letter that appears earlier in the alphabet than the corresponding letter in b;
* if it is an even position, the string a has a letter that appears later in the alphabet than the corresponding letter in b.
Input
The first line contains two integers n and m (1 β€ n β
m β€ 10^6).
The i-th of the next n lines contains a string s_i consisting of m uppercase Latin letters β the book title. The strings are pairwise distinct.
Output
Output n integers β the indices of the strings after they are sorted asc-desc-endingly.
Example
Input
5 2
AA
AB
BB
BA
AZ
Output
5 2 1 3 4
Note
The following illustrates the first example.
<image>"
"Mr. Chanek lives in a city represented as a plane. He wants to build an amusement park in the shape of a circle of radius r. The circle must touch the origin (point (0, 0)).
There are n bird habitats that can be a photo spot for the tourists in the park. The i-th bird habitat is at point p_i = (x_i, y_i).
Find the minimum radius r of a park with at least k bird habitats inside.
A point is considered to be inside the park if and only if the distance between p_i and the center of the park is less than or equal to the radius of the park. Note that the center and the radius of the park do not need to be integers.
In this problem, it is guaranteed that the given input always has a solution with r β€ 2 β
10^5.
Input
The first line contains two integers n and k (1 β€ n β€ 10^5, 1 β€ k β€ n) β the number of bird habitats in the city and the number of bird habitats required to be inside the park.
The i-th of the next n lines contains two integers x_i and y_i (0 β€ |x_i|, |y_i| β€ 10^5) β the position of the i-th bird habitat.
Output
Output a single real number r denoting the minimum radius of a park with at least k bird habitats inside. It is guaranteed that the given input always has a solution with r β€ 2 β
10^5.
Your answer is considered correct if its absolute or relative error does not exceed 10^{-4}.
Formally, let your answer be a, and the jury's answer be b. Your answer is accepted if and only if \frac{|a - b|}{max{(1, |b|)}} β€ 10^{-4}.
Examples
Input
8 4
-3 1
-4 4
1 5
2 2
2 -2
-2 -4
-1 -1
-6 0
Output
3.1622776589
Input
1 1
0 0
Output
0.0000000000
Note
In the first example, Mr. Chanek can put the center of the park at (-3, -1) with radius β{10} β 3.162. It can be proven this is the minimum r.
The following illustrates the first example. The blue points represent bird habitats and the red circle represents the amusement park.
<image>"
"Denote a cyclic sequence of size n as an array s such that s_n is adjacent to s_1. The segment s[r, l] where l < r is the concatenation of s[r, n] and s[1, l].
You are given an array a consisting of n integers. Define b as the cyclic sequence obtained from concatenating m copies of a. Note that b has size n β
m.
You are given an integer k where k = 1 or k is a prime number. Find the number of different segments in b where the sum of elements in the segment is divisible by k.
Two segments are considered different if the set of indices of the segments are different. For example, when n = 3 and m = 2, the set of indices for segment s[2, 5] is \{2, 3, 4, 5\}, and for segment s[5, 2] is \{5, 6, 1, 2\}. In particular, the segments s[1, 6], s[2,1], β¦, s[6, 5] are considered as the same segment.
Output the answer modulo 10^9 + 7.
Input
The first line contains three integers n, m, and k (1 β€ n, m, k β€ 2 β
10^5, k = 1 or k is a prime number).
The second line contains n integers a_1, a_2, β¦, a_n (0 β€ a_i β€ 2 β
10^5).
Output
Output an integer denoting the number of different segments in b where the sum of elements in the segment is divisible by k, modulo 10^9 + 7.
Examples
Input
5 1 5
1 2 3 4 3
Output
4
Input
5 1 5
1 2 3 4 5
Output
5
Input
5 4 5
1 2 3 4 5
Output
125
Note
In the first example, all valid segments are [1,4], [2, 3], [3, 5], and [4, 2].
In the second example, one of the valid segments is [1, 5]."
"Mr. Chanek has an integer represented by a string s. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the number of possible integer s, where s is divisible by 25. Of course, s must not contain any leading zero. He can replace the character _ with any digit. He can also replace the character X with any digit, but it must be the same for every character X.
As a note, a leading zero is any 0 digit that comes before the first nonzero digit in a number string in positional notation. For example, 0025 has two leading zeroes. An exception is the integer zero, (0 has no leading zero, but 0000 has three leading zeroes).
Input
One line containing the string s (1 β€ |s| β€ 8). The string s consists of the characters 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, _, and X.
Output
Output an integer denoting the number of possible integer s.
Examples
Input
25
Output
1
Input
_00
Output
9
Input
_XX
Output
9
Input
0
Output
1
Input
0_25
Output
0
Note
In the first example, the only possible s is 25.
In the second and third example, s β \{100, 200,300,400,500,600,700,800,900\}.
In the fifth example, all possible s will have at least one leading zero."
"There is a city park represented as a tree with n attractions as its vertices and n - 1 rails as its edges. The i-th attraction has happiness value a_i.
Each rail has a color. It is either black if t_i = 0, or white if t_i = 1. Black trains only operate on a black rail track, and white trains only operate on a white rail track. If you are previously on a black train and want to ride a white train, or you are previously on a white train and want to ride a black train, you need to use 1 ticket.
The path of a tour must be a simple path β it must not visit an attraction more than once. You do not need a ticket the first time you board a train. You only have k tickets, meaning you can only switch train types at most k times. In particular, you do not need a ticket to go through a path consisting of one rail color.
Define f(u, v) as the sum of happiness values of the attractions in the tour (u, v), which is a simple path that starts at the u-th attraction and ends at the v-th attraction. Find the sum of f(u,v) for all valid tours (u, v) (1 β€ u β€ v β€ n) that does not need more than k tickets, modulo 10^9 + 7.
Input
The first line contains two integers n and k (2 β€ n β€ 2 β
10^5, 0 β€ k β€ n-1) β the number of attractions in the city park and the number of tickets you have.
The second line contains n integers a_1, a_2,β¦, a_n (0 β€ a_i β€ 10^9) β the happiness value of each attraction.
The i-th of the next n - 1 lines contains three integers u_i, v_i, and t_i (1 β€ u_i, v_i β€ n, 0 β€ t_i β€ 1) β an edge between vertices u_i and v_i with color t_i. The given edges form a tree.
Output
Output an integer denoting the total happiness value for all valid tours (u, v) (1 β€ u β€ v β€ n), modulo 10^9 + 7.
Examples
Input
5 0
1 3 2 6 4
1 2 1
1 4 0
3 2 1
2 5 0
Output
45
Input
3 1
1 1 1
1 2 1
3 2 0
Output
10"
"Mr. Chanek opened a letter from his fellow, who is currently studying at Singanesia. Here is what it says.
Define an array b (0 β€ b_i < k) with n integers. While there exists a pair (i, j) such that b_i β b_j, do the following operation:
* Randomly pick a number i satisfying 0 β€ i < n. Note that each number i has a probability of 1/n to be picked.
* Randomly Pick a number j satisfying 0 β€ j < k.
* Change the value of b_i to j. It is possible for b_i to be changed to the same value.
Denote f(b) as the expected number of operations done to b until all elements of b are equal.
You are given two integers n and k, and an array a (-1 β€ a_i < k) of n integers.
For every index i with a_i = -1, replace a_i with a random number j satisfying 0 β€ j < k. Let c be the number of occurrences of -1 in a. There are k^c possibilites of a after the replacement, each with equal probability of being the final array.
Find the expected value of f(a) modulo 10^9 + 7.
Formally, let M = 10^9 + 7. It can be shown that the answer can be expressed as an irreducible fraction p/q, where p and q are integers and q not β‘ 0 \pmod{M}. Output the integer equal to p β
q^{-1} mod M. In other words, output such an integer x that 0 β€ x < M and x β
q β‘ p \pmod{M}.
After reading the letter, Mr. Chanek gave the task to you. Solve it for the sake of their friendship!
Input
The first line contains two integers n and k (2 β€ n β€ 10^5, 2 β€ k β€ 10^9).
The second line contains n integers a_1, a_2, β¦, a_n (-1 β€ a_i < k).
Output
Output an integer denoting the expected value of f(a) modulo 10^9 + 7.
Examples
Input
2 2
0 1
Output
2
Input
2 2
0 -1
Output
1
Input
3 3
0 1 1
Output
12
Input
3 3
-1 -1 -1
Output
11
Input
10 9
-1 0 -1 1 1 2 2 3 3 3
Output
652419213"
"Mr. Chanek has an array a of n integers. The prettiness value of a is denoted as:
$$$β_{i=1}^{n} {β_{j=1}^{n} {\gcd(a_i, a_j) β
\gcd(i, j)}}$$$
where \gcd(x, y) denotes the greatest common divisor (GCD) of integers x and y.
In other words, the prettiness value of an array a is the total sum of \gcd(a_i, a_j) β
\gcd(i, j) for all pairs (i, j).
Help Mr. Chanek find the prettiness value of a, and output the result modulo 10^9 + 7!
Input
The first line contains an integer n (2 β€ n β€ 10^5).
The second line contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ 10^5).
Output
Output an integer denoting the prettiness value of a modulo 10^9 + 7.
Example
Input
5
3 6 2 1 4
Output
77"
"The Winter holiday will be here soon. Mr. Chanek wants to decorate his house's wall with ornaments. The wall can be represented as a binary string a of length n. His favorite nephew has another binary string b of length m (m β€ n).
Mr. Chanek's nephew loves the non-negative integer k. His nephew wants exactly k occurrences of b as substrings in a.
However, Mr. Chanek does not know the value of k. So, for each k (0 β€ k β€ n - m + 1), find the minimum number of elements in a that have to be changed such that there are exactly k occurrences of b in a.
A string s occurs exactly k times in t if there are exactly k different pairs (p,q) such that we can obtain s by deleting p characters from the beginning and q characters from the end of t.
Input
The first line contains two integers n and m (1 β€ m β€ n β€ 500) β size of the binary string a and b respectively.
The second line contains a binary string a of length n.
The third line contains a binary string b of length m.
Output
Output n - m + 2 integers β the (k+1)-th integer denotes the minimal number of elements in a that have to be changed so there are exactly k occurrences of b as a substring in a.
Example
Input
9 3
100101011
101
Output
1 1 0 1 6 -1 -1 -1
Note
For k = 0, to make the string a have no occurrence of 101, you can do one character change as follows.
100101011 β 100100011
For k = 1, you can also change a single character.
100101011 β 100001011
For k = 2, no changes are needed."
"Chanek Jones is back, helping his long-lost relative Indiana Jones, to find a secret treasure in a maze buried below a desert full of illusions.
The map of the labyrinth forms a tree with n rooms numbered from 1 to n and n - 1 tunnels connecting them such that it is possible to travel between each pair of rooms through several tunnels.
The i-th room (1 β€ i β€ n) has a_i illusion rate. To go from the x-th room to the y-th room, there must exist a tunnel between x and y, and it takes max(|a_x + a_y|, |a_x - a_y|) energy. |z| denotes the absolute value of z.
To prevent grave robbers, the maze can change the illusion rate of any room in it. Chanek and Indiana would ask q queries.
There are two types of queries to be done:
* 1\ u\ c β The illusion rate of the x-th room is changed to c (1 β€ u β€ n, 0 β€ |c| β€ 10^9).
* 2\ u\ v β Chanek and Indiana ask you the minimum sum of energy needed to take the secret treasure at room v if they are initially at room u (1 β€ u, v β€ n).
Help them, so you can get a portion of the treasure!
Input
The first line contains two integers n and q (2 β€ n β€ 10^5, 1 β€ q β€ 10^5) β the number of rooms in the maze and the number of queries.
The second line contains n integers a_1, a_2, β¦, a_n (0 β€ |a_i| β€ 10^9) β inital illusion rate of each room.
The i-th of the next n-1 lines contains two integers s_i and t_i (1 β€ s_i, t_i β€ n), meaning there is a tunnel connecting s_i-th room and t_i-th room. The given edges form a tree.
The next q lines contain the query as described. The given queries are valid.
Output
For each type 2 query, output a line containing an integer β the minimum sum of energy needed for Chanek and Indiana to take the secret treasure.
Example
Input
6 4
10 -9 2 -1 4 -6
1 5
5 4
5 6
6 2
6 3
2 1 2
1 1 -3
2 1 2
2 3 3
Output
39
32
0
Note
<image>
In the first query, their movement from the 1-st to the 2-nd room is as follows.
* 1 β 5 β takes max(|10 + 4|, |10 - 4|) = 14 energy.
* 5 β 6 β takes max(|4 + (-6)|, |4 - (-6)|) = 10 energy.
* 6 β 2 β takes max(|-6 + (-9)|, |-6 - (-9)|) = 15 energy.
In total, it takes 39 energy.
In the second query, the illusion rate of the 1-st room changes from 10 to -3.
In the third query, their movement from the 1-st to the 2-nd room is as follows.
* 1 β 5 β takes max(|-3 + 4|, |-3 - 4|) = 7 energy.
* 5 β 6 β takes max(|4 + (-6)|, |4 - (-6)|) = 10 energy.
* 6 β 2 β takes max(|-6 + (-9)|, |-6 - (-9)|) = 15 energy.
Now, it takes 32 energy."
"Mr. Chanek has a new game called Dropping Balls. Initially, Mr. Chanek has a grid a of size n Γ m
Each cell (x,y) contains an integer a_{x,y} denoting the direction of how the ball will move.
* a_{x,y}=1 β the ball will move to the right (the next cell is (x, y + 1));
* a_{x,y}=2 β the ball will move to the bottom (the next cell is (x + 1, y));
* a_{x,y}=3 β the ball will move to the left (the next cell is (x, y - 1)).
Every time a ball leaves a cell (x,y), the integer a_{x,y} will change to 2. Mr. Chanek will drop k balls sequentially, each starting from the first row, and on the c_1, c_2, ..., c_k-th (1 β€ c_i β€ m) columns.
Determine in which column each ball will end up in (position of the ball after leaving the grid).
Input
The first line contains three integers n, m, and k (1 β€ n, m β€ 1000, 1 β€ k β€ 10^5) β the size of the grid and the number of balls dropped by Mr. Chanek.
The i-th of the next n lines contains m integers a_{i,1},a_{i,2},β¦,a_{i,m} (1 β€ a_{i,j} β€ 3). It will satisfy a_{i, 1} β 3 and a_{i, m} β 1.
The next line contains k integers c_1, c_2, β¦, c_k (1 β€ c_i β€ m) β the balls' column positions dropped by Mr. Chanek sequentially.
Output
Output k integers β the i-th integer denoting the column where the i-th ball will end.
Examples
Input
5 5 3
1 2 3 3 3
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2
1 2 1
Output
2 2 1
Input
1 2 2
1 3
1 2
Output
1 2
Note
In the first example, the first ball will drop as follows. Note that the cell (1, 1) will change direction to the bottom direction.
<image>
The second and third balls will drop as follows.
<image>
All balls will be dropped from the first row and on the c_1, c_2, ..., c_k-th columns respectively. A ball will stop dropping once it leaves the grid."
"Mr. Chanek wants to knit a batik, a traditional cloth from Indonesia. The cloth forms a grid a with size n Γ m. There are k colors, and each cell in the grid can be one of the k colors.
Define a sub-rectangle as an ordered pair of two cells ((x_1, y_1), (x_2, y_2)), denoting the top-left cell and bottom-right cell (inclusively) of a sub-rectangle in a. Two sub-rectangles ((x_1, y_1), (x_2, y_2)) and ((x_3, y_3), (x_4, y_4)) have the same pattern if and only if the following holds:
* they have the same width (x_2 - x_1 = x_4 - x_3);
* they have the same height (y_2 - y_1 = y_4 - y_3);
* for every pair (i, j) where 0 β€ i β€ x_2 - x_1 and 0 β€ j β€ y_2 - y_1, the color of cells (x_1 + i, y_1 + j) and (x_3 + i, y_3 + j) are equal.
Count the number of possible batik color combinations, such that the subrectangles ((a_x, a_y),(a_x + r - 1, a_y + c - 1)) and ((b_x, b_y),(b_x + r - 1, b_y + c - 1)) have the same pattern.
Output the answer modulo 10^9 + 7.
Input
The first line contains five integers n, m, k, r, and c (1 β€ n, m β€ 10^9, 1 β€ k β€ 10^9, 1 β€ r β€ min(10^6, n), 1 β€ c β€ min(10^6, m)) β the size of the batik, the number of colors, and size of the sub-rectangle.
The second line contains four integers a_x, a_y, b_x, and b_y (1 β€ a_x, b_x β€ n, 1 β€ a_y, b_y β€ m) β the top-left corners of the first and second sub-rectangle. Both of the sub-rectangles given are inside the grid (1 β€ a_x + r - 1, b_x + r - 1 β€ n, 1 β€ a_y + c - 1, b_y + c - 1 β€ m).
Output
Output an integer denoting the number of possible batik color combinations modulo 10^9 + 7.
Examples
Input
3 3 2 2 2
1 1 2 2
Output
32
Input
4 5 170845 2 2
1 4 3 1
Output
756680455
Note
The following are all 32 possible color combinations in the first example.
<image>"
"Mr. Chanek gives you a sequence a indexed from 1 to n. Define f(a) as the number of indices where a_i = i.
You can pick an element from the current sequence and remove it, then concatenate the remaining elements together. For example, if you remove the 3-rd element from the sequence [4, 2, 3, 1], the resulting sequence will be [4, 2, 1].
You want to remove some elements from a in order to maximize f(a), using zero or more operations. Find the largest possible f(a).
Input
The first line contains one integer n (1 β€ n β€ 2 β
10^5) β the initial length of the sequence.
The second line contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ 2 β
10^5) β the initial sequence a.
Output
Output an integer denoting the largest f(a) that can be obtained by doing zero or more operations.
Examples
Input
7
2 1 4 2 5 3 7
Output
3
Input
4
4 2 3 1
Output
2
Note
In the first example, f(A) = 3 by doing the following operations.
[2,1,4,2,5,3,7] β [2,1,2,5,3,7] β [1,2,5,3,7] β [1,2,5,3] β [1,2,3]
In the second example, f(A) = 2 and no additional operation is needed."
"Mr. Chanek's city can be represented as a plane. He wants to build a housing complex in the city.
There are some telephone poles on the plane, which is represented by a grid a of size (n + 1) Γ (m + 1). There is a telephone pole at (x, y) if a_{x, y} = 1.
For each point (x, y), define S(x, y) as the square of the Euclidean distance between the nearest pole and (x, y). Formally, the square of the Euclidean distance between two points (x_1, y_1) and (x_2, y_2) is (x_2 - x_1)^2 + (y_2 - y_1)^2.
To optimize the building plan, the project supervisor asks you the sum of all S(x, y) for each 0 β€ x β€ n and 0 β€ y β€ m. Help him by finding the value of β_{x=0}^{n} {β_{y=0}^{m} {S(x, y)}}.
Input
The first line contains two integers n and m (0 β€ n, m < 2000) β the size of the grid.
Then (n + 1) lines follow, each containing (m + 1) integers a_{i, j} (0 β€ a_{i, j} β€ 1) β the grid denoting the positions of telephone poles in the plane. There is at least one telephone pole in the given grid.
Output
Output an integer denoting the value of β_{x=0}^{n} {β_{y=0}^{m} {S(x, y)}}.
Examples
Input
2 2
101
000
000
Output
18
Input
5 4
10010
00000
01000
00001
00100
00010
Output
36
Note
<image>
In the first example, the nearest telephone pole for the points (0,0), (1,0), (2,0), (0,1), (1,1), and (2,1) is at (0, 0). While the nearest telephone pole for the points (0, 2), (1,2), and (2,2) is at (0, 2). Thus, β_{x=0}^{n} {β_{y=0}^{m} {S(x, y)}} = (0 + 1 + 4) + (1 + 2 + 5) + (0 + 1 + 4) = 18."
"Casimir has a string s which consists of capital Latin letters 'A', 'B', and 'C' only. Each turn he can choose to do one of the two following actions:
* he can either erase exactly one letter 'A' and exactly one letter 'B' from arbitrary places of the string (these letters don't have to be adjacent);
* or he can erase exactly one letter 'B' and exactly one letter 'C' from arbitrary places in the string (these letters don't have to be adjacent).
Therefore, each turn the length of the string is decreased exactly by 2. All turns are independent so for each turn, Casimir can choose any of two possible actions.
For example, with s = ""ABCABC"" he can obtain a string s = ""ACBC"" in one turn (by erasing the first occurrence of 'B' and the second occurrence of 'A'). There are also many other options for a turn aside from this particular example.
For a given string s determine whether there is a sequence of actions leading to an empty string. In other words, Casimir's goal is to erase all letters from the string. Is there a way to do this?
Input
The first line contains an integer t (1 β€ t β€ 1000) β the number of test cases.
Each test case is described by one string s, for which you need to determine if it can be fully erased by some sequence of turns. The string s consists of capital letters 'A', 'B', 'C' and has a length from 1 to 50 letters, inclusive.
Output
Print t lines, each line containing the answer to the corresponding test case. The answer to a test case should be YES if there is a way to fully erase the corresponding string and NO otherwise.
You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes, and YES will all be recognized as positive answers).
Example
Input
6
ABACAB
ABBA
AC
ABC
CABCBB
BCBCBCBCBCBCBCBC
Output
NO
YES
NO
NO
YES
YES"
"The new generation external memory contains an array of integers a[1 β¦ n] = [a_1, a_2, β¦, a_n].
This type of memory does not support changing the value of an arbitrary element. Instead, it allows you to cut out any segment of the given array, cyclically shift (rotate) it by any offset and insert it back into the same place.
Technically, each cyclic shift consists of two consecutive actions:
1. You may select arbitrary indices l and r (1 β€ l < r β€ n) as the boundaries of the segment.
2. Then you replace the segment a[l β¦ r] with it's cyclic shift to the left by an arbitrary offset d. The concept of a cyclic shift can be also explained by following relations: the sequence [1, 4, 1, 3] is a cyclic shift of the sequence [3, 1, 4, 1] to the left by the offset 1 and the sequence [4, 1, 3, 1] is a cyclic shift of the sequence [3, 1, 4, 1] to the left by the offset 2.
For example, if a = [1, \color{blue}{3, 2, 8}, 5], then choosing l = 2, r = 4 and d = 2 yields a segment a[2 β¦ 4] = [3, 2, 8]. This segment is then shifted by the offset d = 2 to the left, and you get a segment [8, 3, 2] which then takes the place of of the original elements of the segment. In the end you get a = [1, \color{blue}{8, 3, 2}, 5].
Sort the given array a using no more than n cyclic shifts of any of its segments. Note that you don't need to minimize the number of cyclic shifts. Any method that requires n or less cyclic shifts will be accepted.
Input
The first line contains an integer t (1 β€ t β€ 1000) β the number of test cases.
The next 2t lines contain the descriptions of the test cases.
The first line of each test case description contains an integer n (2 β€ n β€ 50) β the length of the array. The second line consists of space-separated elements of the array a_i (-10^9 β€ a_i β€ 10^9). Elements of array a may repeat and don't have to be unique.
Output
Print t answers to all input test cases.
The first line of the answer of each test case should contain an integer k (0 β€ k β€ n) β the number of actions to sort the array. The next k lines should contain descriptions of the actions formatted as ""l r d"" (without quotes) where l and r (1 β€ l < r β€ n) are the boundaries of the segment being shifted, while d (1 β€ d β€ r - l) is the offset value. Please remember that only the cyclic shifts to the left are considered so the chosen segment will be shifted by the offset d to the to the left.
Note that you are not required to find the minimum number of cyclic shifts needed for sorting. Any sorting method where the number of shifts does not exceed n will be accepted.
If the given array a is already sorted, one of the possible answers is k = 0 and an empty sequence of cyclic shifts.
If there are several possible answers, you may print any of them.
Example
Input
4
2
2 1
3
1 2 1
4
2 4 1 3
5
2 5 1 4 3
Output
1
1 2 1
1
1 3 2
3
2 4 1
2 3 1
1 3 2
4
2 4 2
1 5 3
1 2 1
1 3 1
Note
Explanation of the fourth data set in the example:
1. The segment a[2 β¦ 4] is selected and is shifted to the left by 2: [2, \color{blue}{5, 1, 4}, 3] \longrightarrow [2, \color{blue}{4, 5, 1}, 3]
2. The segment a[1 β¦ 5] is then selected and is shifted to the left by 3: [\color{blue}{2, 4, 5, 1, 3}] \longrightarrow [\color{blue}{1, 3, 2, 4, 5}]
3. After that the segment a[1 β¦ 2] is selected and is shifted to the left by 1: [\color{blue}{1, 3}, 2, 4, 5] \longrightarrow [\color{blue}{3, 1}, 2, 4, 5]
4. And in the end the segment a[1 β¦ 3] is selected and is shifted to the left by 1: [\color{blue}{3, 1, 2}, 4, 5] \longrightarrow [\color{blue}{1, 2, 3}, 4, 5] "
"Casimir has a rectangular piece of paper with a checkered field of size n Γ m. Initially, all cells of the field are white.
Let us denote the cell with coordinates i vertically and j horizontally by (i, j). The upper left cell will be referred to as (1, 1) and the lower right cell as (n, m).
Casimir draws ticks of different sizes on the field. A tick of size d (d > 0) with its center in cell (i, j) is drawn as follows:
1. First, the center cell (i, j) is painted black.
2. Then exactly d cells on the top-left diagonally to the center and exactly d cells on the top-right diagonally to the center are also painted black.
3. That is all the cells with coordinates (i - h, j Β± h) for all h between 0 and d are painted. In particular, a tick consists of 2d + 1 black cells.
An already painted cell will remain black if painted again. Below you can find an example of the 4 Γ 9 box, with two ticks of sizes 2 and 3.
<image>
You are given a description of a checkered field of size n Γ m. Casimir claims that this field came about after he drew some (possibly 0) ticks on it. The ticks could be of different sizes, but the size of each tick is at least k (that is, d β₯ k for all the ticks).
Determine whether this field can indeed be obtained by drawing some (possibly none) ticks of sizes d β₯ k or not.
Input
The first line contains an integer t (1 β€ t β€ 100) β the number test cases.
The following lines contain the descriptions of the test cases.
The first line of the test case description contains the integers n, m, and k (1 β€ k β€ n β€ 10; 1 β€ m β€ 19) β the field size and the minimum size of the ticks that Casimir drew. The following n lines describe the field: each line consists of m characters either being '.' if the corresponding cell is not yet painted or '*' otherwise.
Output
Print t lines, each line containing the answer to the corresponding test case. The answer to a test case should be YES if the given field can be obtained by drawing ticks of at least the given size and NO otherwise.
You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes, and YES will all be recognized as positive answers).
Example
Input
8
2 3 1
*.*
...
4 9 2
*.*.*...*
.*.*...*.
..*.*.*..
.....*...
4 4 1
*.*.
****
.**.
....
5 5 1
.....
*...*
.*.*.
..*.*
...*.
5 5 2
.....
*...*
.*.*.
..*.*
...*.
4 7 1
*.....*
.....*.
..*.*..
...*...
3 3 1
***
***
***
3 5 1
*...*
.***.
.**..
Output
NO
YES
YES
YES
NO
NO
NO
NO
Note
The first sample test case consists of two asterisks neither of which can be independent ticks since ticks of size 0 don't exist.
The second sample test case is already described in the statement (check the picture in the statement). This field can be obtained by drawing ticks of sizes 2 and 3, as shown in the figure.
The field in the third sample test case corresponds to three ticks of size 1. Their center cells are marked with \color{blue}{blue}, \color{red}{red} and \color{green}{green} colors: *.*.
---
*\color{blue}{*}**
.\color{green}{*}\color{red}{*}.
....
The field in the fourth sample test case could have been obtained by drawing two ticks of sizes 1 and 2. Their vertices are marked below with \color{blue}{blue} and \color{red}{red} colors respectively: .....
---
*...*
.*.*.
..\color{red}{*}.*
...\color{blue}{*}.
The field in the fifth sample test case can not be obtained because k = 2, and the last asterisk in the fourth row from the top with coordinates (4, 5) can only be a part of a tick of size 1.
The field in the sixth sample test case can not be obtained because the top left asterisk (1, 1) can't be an independent tick, since the sizes of the ticks must be positive, and cannot be part of a tick with the center cell in the last row, since it is separated from it by a gap (a point, '.') in (2, 2).
In the seventh sample test case, similarly, the field can not be obtained by the described process because the asterisks with coordinates (1, 2) (second cell in the first row), (3, 1) and (3, 3) (leftmost and rightmost cells in the bottom) can not be parts of any ticks."
"An important meeting is to be held and there are exactly n people invited. At any moment, any two people can step back and talk in private. The same two people can talk several (as many as they want) times per meeting.
Each person has limited sociability. The sociability of the i-th person is a non-negative integer a_i. This means that after exactly a_i talks this person leaves the meeting (and does not talk to anyone else anymore). If a_i = 0, the i-th person leaves the meeting immediately after it starts.
A meeting is considered most productive if the maximum possible number of talks took place during it.
You are given an array of sociability a, determine which people should talk to each other so that the total number of talks is as large as possible.
Input
The first line contains an integer t (1 β€ t β€ 1000) β the number of test cases.
The next 2t lines contain descriptions of the test cases.
The first line of each test case description contains an integer n (2 β€ n β€ 2 β
10^5) βthe number of people in the meeting. The second line consists of n space-separated integers a_1, a_2, ..., a_n (0 β€ a_i β€ 2 β
10^5) β the sociability parameters of all people.
It is guaranteed that the sum of n over all test cases does not exceed 2 β
10^5. It is also guaranteed that the sum of all a_i (over all test cases and all i) does not exceed 2 β
10^5.
Output
Print t answers to all test cases.
On the first line of each answer print the number k β the maximum number of talks possible in a meeting.
On each of the next k lines print two integers i and j (1 β€ i, j β€ n and i β j) β the numbers of people who will have another talk.
If there are several possible answers, you may print any of them.
Example
Input
8
2
2 3
3
1 2 3
4
1 2 3 4
3
0 0 2
2
6 2
3
0 0 2
5
8 2 0 1 1
5
0 1 0 0 6
Output
2
1 2
1 2
3
1 3
2 3
2 3
5
1 3
2 4
2 4
3 4
3 4
0
2
1 2
1 2
0
4
1 2
1 5
1 4
1 2
1
5 2"
"In fact, the problems E1 and E2 do not have much in common. You should probably think of them as two separate problems.
You are given an integer array a[1 β¦ n] = [a_1, a_2, β¦, a_n].
Let us consider an empty [deque](https://tinyurl.com/pfeucbux) (double-ended queue). A deque is a data structure that supports adding elements to both the beginning and the end. So, if there are elements [3, 4, 4] currently in the deque, adding an element 1 to the beginning will produce the sequence [\color{red}{1}, 3, 4, 4], and adding the same element to the end will produce [3, 4, 4, \color{red}{1}].
The elements of the array are sequentially added to the initially empty deque, starting with a_1 and finishing with a_n. Before adding each element to the deque, you may choose whether to add it to the beginning or to the end.
For example, if we consider an array a = [3, 7, 5, 5], one of the possible sequences of actions looks like this: 1. | add 3 to the beginning of the deque: | deque has a sequence [\color{red}{3}] in it;
---|---|---
2. | add 7 to the end of the deque: | deque has a sequence [3, \color{red}{7}] in it;
3. | add 5 to the end of the deque: | deque has a sequence [3, 7, \color{red}{5}] in it;
4. | add 5 to the beginning of the deque: | deque has a sequence [\color{red}{5}, 3, 7, 5] in it;
Find the minimal possible number of inversions in the deque after the whole array is processed.
An inversion in sequence d is a pair of indices (i, j) such that i < j and d_i > d_j. For example, the array d = [5, 3, 7, 5] has exactly two inversions β (1, 2) and (3, 4), since d_1 = 5 > 3 = d_2 and d_3 = 7 > 5 = d_4.
Input
The first line contains an integer t (1 β€ t β€ 1000) β the number of test cases.
The next 2t lines contain descriptions of the test cases.
The first line of each test case description contains an integer n (1 β€ n β€ 2 β
10^5) β array size. The second line of the description contains n space-separated integers a_i (-10^9 β€ a_i β€ 10^9) β elements of the array.
It is guaranteed that the sum of n over all test cases does not exceed 2 β
10^5.
Output
Print t lines, each line containing the answer to the corresponding test case. The answer to a test case should be a single integer β the minimal possible number of inversions in the deque after executing the described algorithm.
Example
Input
6
4
3 7 5 5
3
3 2 1
3
3 1 2
4
-1 2 2 -1
4
4 5 1 3
5
1 3 1 3 2
Output
2
0
1
0
1
2
Note
One of the ways to get the sequence [5, 3, 7, 5] in the deque, containing only two inversions, from the initial array [3, 7, 5, 5] (the first sample test case) is described in the problem statement.
Also, in this example, you could get the answer of two inversions by simply putting each element of the original array at the end of the deque. In this case, the original sequence [3, 7, 5, 5], also containing exactly two inversions, will be in the deque as-is."
"You are given an array a[0 β¦ n - 1] = [a_0, a_1, β¦, a_{n - 1}] of zeroes and ones only. Note that in this problem, unlike the others, the array indexes are numbered from zero, not from one.
In one step, the array a is replaced by another array of length n according to the following rules:
1. First, a new array a^{β d} is defined as a cyclic shift of the array a to the right by d cells. The elements of this array can be defined as a^{β d}_i = a_{(i + n - d) mod n}, where (i + n - d) mod n is the remainder of integer division of i + n - d by n.
It means that the whole array a^{β d} can be represented as a sequence $$$a^{β d} = [a_{n - d}, a_{n - d + 1}, β¦, a_{n - 1}, a_0, a_1, β¦, a_{n - d - 1}]$$$
2. Then each element of the array a_i is replaced by a_i \& a^{β d}_i, where \& is a logical ""AND"" operator.
For example, if a = [0, 0, 1, 1] and d = 1, then a^{β d} = [1, 0, 0, 1] and the value of a after the first step will be [0 \& 1, 0 \& 0, 1 \& 0, 1 \& 1], that is [0, 0, 0, 1].
The process ends when the array stops changing. For a given array a, determine whether it will consist of only zeros at the end of the process. If yes, also find the number of steps the process will take before it finishes.
Input
The first line contains an integer t (1 β€ t β€ 1000) β the number of test cases.
The next 2t lines contain descriptions of the test cases.
The first line of each test case description contains two integers: n (1 β€ n β€ 10^6) β array size and d (1 β€ d β€ n) β cyclic shift offset. The second line of the description contains n space-separated integers a_i (0 β€ a_i β€ 1) β elements of the array.
It is guaranteed that the sum of n over all test cases does not exceed 10^6.
Output
Print t lines, each line containing the answer to the corresponding test case. The answer to a test case should be a single integer β the number of steps after which the array will contain only zeros for the first time. If there are still elements equal to 1 in the array after the end of the process, print -1.
Example
Input
5
2 1
0 1
3 2
0 1 0
5 2
1 1 0 1 0
4 2
0 1 0 1
1 1
0
Output
1
1
3
-1
0
Note
In the third sample test case the array will change as follows:
1. At the beginning a = [1, 1, 0, 1, 0], and a^{β 2} = [1, 0, 1, 1, 0]. Their element-by-element ""AND"" is equal to $$$[1 \& 1, 1 \& 0, 0 \& 1, 1 \& 1, 0 \& 0] = [1, 0, 0, 1, 0]$$$
2. Now a = [1, 0, 0, 1, 0], then a^{β 2} = [1, 0, 1, 0, 0]. Their element-by-element ""AND"" equals to $$$[1 \& 1, 0 \& 0, 0 \& 1, 1 \& 0, 0 \& 0] = [1, 0, 0, 0, 0]$$$
3. And finally, when a = [1, 0, 0, 0, 0] we get a^{β 2} = [0, 0, 1, 0, 0]. Their element-by-element ""AND"" equals to $$$[1 \& 0, 0 \& 0, 0 \& 1, 0 \& 0, 0 \& 0] = [0, 0, 0, 0, 0]$$$
Thus, the answer is 3 steps.
In the fourth sample test case, the array will not change as it shifts by 2 to the right, so each element will be calculated as 0 \& 0 or 1 \& 1 thus not changing its value. So the answer is -1, the array will never contain only zeros."
"You are given n lengths of segments that need to be placed on an infinite axis with coordinates.
The first segment is placed on the axis so that one of its endpoints lies at the point with coordinate 0. Let's call this endpoint the ""start"" of the first segment and let's call its ""end"" as that endpoint that is not the start.
The ""start"" of each following segment must coincide with the ""end"" of the previous one. Thus, if the length of the next segment is d and the ""end"" of the previous one has the coordinate x, the segment can be placed either on the coordinates [x-d, x], and then the coordinate of its ""end"" is x - d, or on the coordinates [x, x+d], in which case its ""end"" coordinate is x + d.
The total coverage of the axis by these segments is defined as their overall union which is basically the set of points covered by at least one of the segments. It's easy to show that the coverage will also be a segment on the axis. Determine the minimal possible length of the coverage that can be obtained by placing all the segments on the axis without changing their order.
Input
The first line contains an integer t (1 β€ t β€ 1000) β the number of test cases.
The next 2t lines contain descriptions of the test cases.
The first line of each test case description contains an integer n (1 β€ n β€ 10^4) β the number of segments. The second line of the description contains n space-separated integers a_i (1 β€ a_i β€ 1000) β lengths of the segments in the same order they should be placed on the axis.
It is guaranteed that the sum of n over all test cases does not exceed 10^4.
Output
Print t lines, each line containing the answer to the corresponding test case. The answer to a test case should be a single integer β the minimal possible length of the axis coverage.
Example
Input
6
2
1 3
3
1 2 3
4
6 2 3 9
4
6 8 4 5
7
1 2 4 6 7 7 3
8
8 6 5 1 2 2 3 6
Output
3
3
9
9
7
8
Note
In the third sample test case the segments should be arranged as follows: [0, 6] β [4, 6] β [4, 7] β [-2, 7]. As you can see, the last segment [-2, 7] covers all the previous ones, and the total length of coverage is 9.
In the fourth sample test case the segments should be arranged as [0, 6] β [-2, 6] β [-2, 2] β [2, 7]. The union of these segments also occupies the area [-2, 7] and has the length of 9."
"CQXYM found a rectangle A of size n Γ m. There are n rows and m columns of blocks. Each block of the rectangle is an obsidian block or empty. CQXYM can change an obsidian block to an empty block or an empty block to an obsidian block in one operation.
A rectangle M size of a Γ b is called a portal if and only if it satisfies the following conditions:
* a β₯ 5,b β₯ 4.
* For all 1 < x < a, blocks M_{x,1} and M_{x,b} are obsidian blocks.
* For all 1 < x < b, blocks M_{1,x} and M_{a,x} are obsidian blocks.
* For all 1<x<a,1<y<b, block M_{x,y} is an empty block.
* M_{1, 1}, M_{1, b}, M_{a, 1}, M_{a, b} can be any type.
Note that the there must be a rows and b columns, not b rows and a columns.
Note that corners can be any type
CQXYM wants to know the minimum number of operations he needs to make at least one sub-rectangle a portal.
Input
The first line contains an integer t (t β₯ 1), which is the number of test cases.
For each test case, the first line contains two integers n and m (5 β€ n β€ 400, 4 β€ m β€ 400).
Then n lines follow, each line contains m characters 0 or 1. If the j-th character of i-th line is 0, block A_{i,j} is an empty block. Otherwise, block A_{i,j} is an obsidian block.
It is guaranteed that the sum of n over all test cases does not exceed 400.
It is guaranteed that the sum of m over all test cases does not exceed 400.
Output
Output t answers, and each answer in a line.
Examples
Input
1
5 4
1000
0000
0110
0000
0001
Output
12
Input
1
9 9
001010001
101110100
000010011
100000001
101010101
110001111
000001111
111100000
000110000
Output
5
Note
In the first test case, the final portal is like this:
1110
1001
1001
1001
0111
"
"Let c_1, c_2, β¦, c_n be a permutation of integers 1, 2, β¦, n. Consider all subsegments of this permutation containing an integer x. Given an integer m, we call the integer x good if there are exactly m different values of maximum on these subsegments.
Cirno is studying mathematics, and the teacher asks her to count the number of permutations of length n with exactly k good numbers.
Unfortunately, Cirno isn't good at mathematics, and she can't answer this question. Therefore, she asks you for help.
Since the answer may be very big, you only need to tell her the number of permutations modulo p.
A permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appears twice in the array) and [1,3,4] is also not a permutation (n=3 but there is 4 in the array).
A sequence a is a subsegment of a sequence b if a can be obtained from b by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.
Input
The first line contains four integers n, m, k, p (1 β€ n β€ 100, 1 β€ m β€ n, 1 β€ k β€ n, 1 β€ p β€ 10^9).
Output
Output the number of permutations modulo p.
Examples
Input
4 3 2 10007
Output
4
Input
6 4 1 769626776
Output
472
Input
66 11 9 786747482
Output
206331312
Input
99 30 18 650457567
Output
77365367
Note
In the first test case, there are four permutations: [1, 3, 2, 4], [2, 3, 1, 4], [4, 1, 3, 2] and [4, 2, 3, 1].
Take permutation [1, 3, 2, 4] as an example:
For number 1, all subsegments containing it are: [1], [1, 3], [1, 3, 2] and [1, 3, 2, 4], and there're three different maxima 1, 3 and 4.
Similarly, for number 3, there're two different maxima 3 and 4. For number 2, there're three different maxima 2, 3 and 4. And for number 4, there're only one, that is 4 itself."
"Kawasiro Nitori is excellent in engineering. Thus she has been appointed to help maintain trains.
There are n models of trains, and Nitori's department will only have at most one train of each model at any moment. In the beginning, there are no trains, at each of the following m days, one train will be added, or one train will be removed. When a train of model i is added at day t, it works for x_i days (day t inclusive), then it is in maintenance for y_i days, then in work for x_i days again, and so on until it is removed.
In order to make management easier, Nitori wants you to help her calculate how many trains are in maintenance in each day.
On a day a train is removed, it is not counted as in maintenance.
Input
The first line contains two integers n, m (1 β€ n,m β€ 2 β
10^5).
The i-th of the next n lines contains two integers x_i,y_i (1 β€ x_i,y_i β€ 10^9).
Each of the next m lines contains two integers op, k (1 β€ k β€ n, op = 1 or op = 2). If op=1, it means this day's a train of model k is added, otherwise the train of model k is removed. It is guaranteed that when a train of model x is added, there is no train of the same model in the department, and when a train of model x is removed, there is such a train in the department.
Output
Print m lines, The i-th of these lines contains one integers, denoting the number of trains in maintenance in the i-th day.
Examples
Input
3 4
10 15
12 10
1 1
1 3
1 1
2 1
2 3
Output
0
1
0
0
Input
5 4
1 1
10000000 100000000
998244353 1
2 1
1 2
1 5
2 5
1 5
1 1
Output
0
0
0
1
Note
Consider the first example:
The first day: Nitori adds a train of model 3. Only a train of model 3 is running and no train is in maintenance.
The second day: Nitori adds a train of model 1. A train of model 1 is running and a train of model 3 is in maintenance.
The third day: Nitori removes a train of model 1. The situation is the same as the first day.
The fourth day: Nitori removes a train of model 3. There are no trains at all."
"Alice has an integer sequence a of length n and all elements are different. She will choose a subsequence of a of length m, and defines the value of a subsequence a_{b_1},a_{b_2},β¦,a_{b_m} as $$$β_{i = 1}^m (m β
a_{b_i}) - β_{i = 1}^m β_{j = 1}^m f(min(b_i, b_j), max(b_i, b_j)), where f(i, j) denotes \min(a_i, a_{i + 1}, \ldots, a_j)$$$.
Alice wants you to help her to maximize the value of the subsequence she choose.
A sequence s is a subsequence of a sequence t if s can be obtained from t by deletion of several (possibly, zero or all) elements.
Input
The first line contains two integers n and m (1 β€ m β€ n β€ 4000).
The second line contains n distinct integers a_1, a_2, β¦, a_n (1 β€ a_i < 2^{31}).
Output
Print the maximal value Alice can get.
Examples
Input
6 4
15 2 18 12 13 4
Output
100
Input
11 5
9 3 7 1 8 12 10 20 15 18 5
Output
176
Input
1 1
114514
Output
0
Input
2 1
666 888
Output
0
Note
In the first example, Alice can choose the subsequence [15, 2, 18, 13], which has the value 4 β
(15 + 2 + 18 + 13) - (15 + 2 + 2 + 2) - (2 + 2 + 2 + 2) - (2 + 2 + 18 + 12) - (2 + 2 + 12 + 13) = 100. In the second example, there are a variety of subsequences with value 176, and one of them is [9, 7, 12, 20, 18]."
"Because the railway system in Gensokyo is often congested, as an enthusiastic engineer, Kawasiro Nitori plans to construct more railway to ease the congestion.
There are n stations numbered from 1 to n and m two-way railways in Gensokyo. Every two-way railway connects two different stations and has a positive integer length d. No two two-way railways connect the same two stations. Besides, it is possible to travel from any station to any other using those railways. Among these n stations, station 1 is the main station. You can get to any station from any other station using only two-way railways.
Because of the technological limitation, Nitori can only construct one-way railways, whose length can be arbitrary positive integer. Constructing a one-way railway from station u will costs w_u units of resources, no matter where the railway ends. To ease the congestion, Nitori plans that after construction there are at least two shortest paths from station 1 to any other station, and these two shortest paths do not pass the same station except station 1 and the terminal. Besides, Nitori also does not want to change the distance of the shortest path from station 1 to any other station.
Due to various reasons, sometimes the cost of building a new railway will increase uncontrollably. There will be a total of q occurrences of this kind of incident, and the i-th event will add additional amount of x_i to the cost of building a new railway from the station k_i.
To save resources, before all incidents and after each incident, Nitori wants you to help her calculate the minimal cost of railway construction.
Input
The first line contains three integers n, m, and q (1 β€ n β€ 2 β
10^5, 1 β€ m β€ 3 β
10^5, 0 β€ q β€ 2β
10^5).
The second line contains n integers w_1,w_2,β¦,w_n (1 β€ w_i β€ 10^9).
Each of the next m lines contains three integers u, v, d (1 β€ u,v β€ n, u β v, 1 β€ d β€ 10^9), denoting a two-way railway connecting station u and station v, with length d.
The i-th of the next q lines contains two integers k_i,x_i (1 β€ k_i β€ n, 1 β€ x_i β€ 4 Γ 10^8).
Output
Print q+1 lines, and the i-th of these lines contains one integer, denoting the minimal cost of railway construction after the i-1-th incident (especially, the 0-th incident means no incident occurred).
Examples
Input
5 5 1
1 1 1 1 1
1 2 1
2 3 1
2 4 1
3 5 1
4 5 1
1 2
Output
3
9
Input
8 11 0
14 4 16 15 1 3 1 14
4 2 1
1 2 3
7 5 4
2 3 1
8 6 2
8 5 5
5 4 5
7 6 7
3 5 5
1 6 6
8 1 4
Output
46
Input
10 16 8
29 1 75 73 51 69 24 17 1 97
1 2 18
2 3 254
2 4 546
2 5 789
5 6 998
6 7 233
7 8 433
1 9 248
5 10 488
2 6 1787
10 8 1176
3 8 2199
4 8 1907
2 10 1277
4 10 731
9 10 1047
1 11
1 9
8 8
1 3
2 19
9 5
9 4
7 6
Output
34
45
54
54
57
76
96
112
112
Note
In the second example, Nitori can build railways as follows: 1 β 2, 1 β 3, 1 β 4, 2 β 8, and the cost is 14 + 14 + 14 + 4 = 46."
"XYMXYM and CQXYM will prepare n problems for Codeforces. The difficulty of the problem i will be an integer a_i, where a_i β₯ 0. The difficulty of the problems must satisfy a_i+a_{i+1}<m (1 β€ i < n), and a_1+a_n<m, where m is a fixed integer. XYMXYM wants to know how many plans of the difficulty of the problems there are modulo 998 244 353.
Two plans of difficulty a and b are different only if there is an integer i (1 β€ i β€ n) satisfying a_i β b_i.
Input
A single line contains two integers n and m (2 β€ n β€ 50 000, 1 β€ m β€ 10^9).
Output
Print a single integer β the number of different plans.
Examples
Input
3 2
Output
4
Input
5 9
Output
8105
Input
21038 3942834
Output
338529212
Note
In the first test case, the valid a are: [0,0,0], [0,0,1], [0,1,0], [1,0,0].
[1,0,1] is invalid since a_1+a_n β₯ m."
"CQXYM is counting permutations length of 2n.
A permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appears twice in the array) and [1,3,4] is also not a permutation (n=3 but there is 4 in the array).
A permutation p(length of 2n) will be counted only if the number of i satisfying p_i<p_{i+1} is no less than n. For example:
* Permutation [1, 2, 3, 4] will count, because the number of such i that p_i<p_{i+1} equals 3 (i = 1, i = 2, i = 3).
* Permutation [3, 2, 1, 4] won't count, because the number of such i that p_i<p_{i+1} equals 1 (i = 3).
CQXYM wants you to help him to count the number of such permutations modulo 1000000007 (10^9+7).
In addition, [modulo operation](https://en.wikipedia.org/wiki/Modulo_operation) is to get the remainder. For example:
* 7 mod 3=1, because 7 = 3 β
2 + 1,
* 15 mod 4=3, because 15 = 4 β
3 + 3.
Input
The input consists of multiple test cases.
The first line contains an integer t (t β₯ 1) β the number of test cases. The description of the test cases follows.
Only one line of each test case contains an integer n(1 β€ n β€ 10^5).
It is guaranteed that the sum of n over all test cases does not exceed 10^5
Output
For each test case, print the answer in a single line.
Example
Input
4
1
2
9
91234
Output
1
12
830455698
890287984
Note
n=1, there is only one permutation that satisfies the condition: [1,2].
In permutation [1,2], p_1<p_2, and there is one i=1 satisfy the condition. Since 1 β₯ n, this permutation should be counted. In permutation [2,1], p_1>p_2. Because 0<n, this permutation should not be counted.
n=2, there are 12 permutations: [1,2,3,4],[1,2,4,3],[1,3,2,4],[1,3,4,2],[1,4,2,3],[2,1,3,4],[2,3,1,4],[2,3,4,1],[2,4,1,3],[3,1,2,4],[3,4,1,2],[4,1,2,3]."
"CQXYM wants to create a connected undirected graph with n nodes and m edges, and the diameter of the graph must be strictly less than k-1. Also, CQXYM doesn't want a graph that contains self-loops or multiple edges (i.e. each edge connects two different vertices and between each pair of vertices there is at most one edge).
The diameter of a graph is the maximum distance between any two nodes.
The distance between two nodes is the minimum number of the edges on the path which endpoints are the two nodes.
CQXYM wonders whether it is possible to create such a graph.
Input
The input consists of multiple test cases.
The first line contains an integer t (1 β€ t β€ 10^5) β the number of test cases. The description of the test cases follows.
Only one line of each test case contains three integers n(1 β€ n β€ 10^9), m, k (0 β€ m,k β€ 10^9).
Output
For each test case, print YES if it is possible to create the graph, or print NO if it is impossible. You can print each letter in any case (upper or lower).
Example
Input
5
1 0 3
4 5 3
4 6 3
5 4 1
2 1 1
Output
YES
NO
YES
NO
NO
Note
In the first test case, the graph's diameter equal to 0.
In the second test case, the graph's diameter can only be 2.
In the third test case, the graph's diameter can only be 1."
"Luntik has decided to try singing. He has a one-minute songs, b two-minute songs and c three-minute songs. He wants to distribute all songs into two concerts such that every song should be included to exactly one concert.
He wants to make the absolute difference of durations of the concerts as small as possible. The duration of the concert is the sum of durations of all songs in that concert.
Please help Luntik and find the minimal possible difference in minutes between the concerts durations.
Input
The first line contains a single integer t (1 β€ t β€ 1000) β the number of test cases.
Each test case consists of one line containing three integers a, b, c (1 β€ a, b, c β€ 10^9) β the number of one-minute, two-minute and three-minute songs.
Output
For each test case print the minimal possible difference in minutes between the concerts durations.
Example
Input
4
1 1 1
2 1 3
5 5 5
1 1 2
Output
0
1
0
1
Note
In the first test case, Luntik can include a one-minute song and a two-minute song into the first concert, and a three-minute song into the second concert. Then the difference will be equal to 0.
In the second test case, Luntik can include two one-minute songs and a two-minute song and a three-minute song into the first concert, and two three-minute songs into the second concert. The duration of the first concert will be 1 + 1 + 2 + 3 = 7, the duration of the second concert will be 6. The difference of them is |7-6| = 1."
"Luntik came out for a morning stroll and found an array a of length n. He calculated the sum s of the elements of the array (s= β_{i=1}^{n} a_i). Luntik calls a subsequence of the array a nearly full if the sum of the numbers in that subsequence is equal to s-1.
Luntik really wants to know the number of nearly full subsequences of the array a. But he needs to come home so he asks you to solve that problem!
A sequence x is a subsequence of a sequence y if x can be obtained from y by deletion of several (possibly, zero or all) elements.
Input
The first line contains a single integer t (1 β€ t β€ 1000) β the number of test cases. The next 2 β
t lines contain descriptions of test cases. The description of each test case consists of two lines.
The first line of each test case contains a single integer n (1 β€ n β€ 60) β the length of the array.
The second line contains n integers a_1, a_2, β¦, a_n (0 β€ a_i β€ 10^9) β the elements of the array a.
Output
For each test case print the number of nearly full subsequences of the array.
Example
Input
5
5
1 2 3 4 5
2
1000 1000
2
1 0
5
3 0 2 1 1
5
2 1 0 3 0
Output
1
0
2
4
4
Note
In the first test case, s=1+2+3+4+5=15, only (2,3,4,5) is a nearly full subsequence among all subsequences, the sum in it is equal to 2+3+4+5=14=15-1.
In the second test case, there are no nearly full subsequences.
In the third test case, s=1+0=1, the nearly full subsequences are (0) and () (the sum of an empty subsequence is 0)."
"Grandma Capa has decided to knit a scarf and asked Grandpa Sher to make a pattern for it, a pattern is a string consisting of lowercase English letters. Grandpa Sher wrote a string s of length n.
Grandma Capa wants to knit a beautiful scarf, and in her opinion, a beautiful scarf can only be knit from a string that is a palindrome. She wants to change the pattern written by Grandpa Sher, but to avoid offending him, she will choose one lowercase English letter and erase some (at her choice, possibly none or all) occurrences of that letter in string s.
She also wants to minimize the number of erased symbols from the pattern. Please help her and find the minimum number of symbols she can erase to make string s a palindrome, or tell her that it's impossible. Notice that she can only erase symbols equal to the one letter she chose.
A string is a palindrome if it is the same from the left to the right and from the right to the left. For example, the strings 'kek', 'abacaba', 'r' and 'papicipap' are palindromes, while the strings 'abb' and 'iq' are not.
Input
The first line contains a single integer t (1 β€ t β€ 100) β the number of test cases. The next 2 β
t lines contain the description of test cases. The description of each test case consists of two lines.
The first line of each test case contains a single integer n (1 β€ n β€ 10^5) β the length of the string.
The second line of each test case contains the string s consisting of n lowercase English letters.
It is guaranteed that the sum of n over all test cases does not exceed 2 β
10^5.
Output
For each test case print the minimum number of erased symbols required to make the string a palindrome, if it is possible, and -1, if it is impossible.
Example
Input
5
8
abcaacab
6
xyzxyz
4
abba
8
rprarlap
10
khyyhhyhky
Output
2
-1
0
3
2
Note
In the first test case, you can choose a letter 'a' and erase its first and last occurrences, you will get a string 'bcaacb', which is a palindrome. You can also choose a letter 'b' and erase all its occurrences, you will get a string 'acaaca', which is a palindrome as well.
In the second test case, it can be shown that it is impossible to choose a letter and erase some of its occurrences to get a palindrome.
In the third test case, you don't have to erase any symbols because the string is already a palindrome."
"Vupsen and Pupsen were gifted an integer array. Since Vupsen doesn't like the number 0, he threw away all numbers equal to 0 from the array. As a result, he got an array a of length n.
Pupsen, on the contrary, likes the number 0 and he got upset when he saw the array without zeroes. To cheer Pupsen up, Vupsen decided to come up with another array b of length n such that β_{i=1}^{n}a_i β
b_i=0. Since Vupsen doesn't like number 0, the array b must not contain numbers equal to 0. Also, the numbers in that array must not be huge, so the sum of their absolute values cannot exceed 10^9. Please help Vupsen to find any such array b!
Input
The first line contains a single integer t (1 β€ t β€ 100) β the number of test cases. The next 2 β
t lines contain the description of test cases. The description of each test case consists of two lines.
The first line of each test case contains a single integer n (2 β€ n β€ 10^5) β the length of the array.
The second line contains n integers a_1, a_2, β¦, a_n (-10^4 β€ a_i β€ 10^4, a_i β 0) β the elements of the array a.
It is guaranteed that the sum of n over all test cases does not exceed 2 β
10^5.
Output
For each test case print n integers b_1, b_2, β¦, b_n β elements of the array b (|b_1|+|b_2|+β¦ +|b_n| β€ 10^9, b_i β 0, β_{i=1}^{n}a_i β
b_i=0).
It can be shown that the answer always exists.
Example
Input
3
2
5 5
5
5 -2 10 -9 4
7
1 2 3 4 5 6 7
Output
1 -1
-1 5 1 -1 -1
-10 2 2 -3 5 -1 -1
Note
In the first test case, 5 β
1 + 5 β
(-1)=5-5=0. You could also print 3 -3, for example, since 5 β
3 + 5 β
(-3)=15-15=0
In the second test case, 5 β
(-1) + (-2) β
5 + 10 β
1 + (-9) β
(-1) + 4 β
(-1)=-5-10+10+9-4=0."
"Pchelyonok decided to give Mila a gift. Pchelenok has already bought an array a of length n, but gifting an array is too common. Instead of that, he decided to gift Mila the segments of that array!
Pchelyonok wants his gift to be beautiful, so he decided to choose k non-overlapping segments of the array [l_1,r_1], [l_2,r_2], β¦ [l_k,r_k] such that:
* the length of the first segment [l_1,r_1] is k, the length of the second segment [l_2,r_2] is k-1, β¦, the length of the k-th segment [l_k,r_k] is 1
* for each i<j, the i-th segment occurs in the array earlier than the j-th (i.e. r_i<l_j)
* the sums in these segments are strictly increasing (i.e. let sum(l β¦ r) = β_{i=l}^{r} a_i β the sum of numbers in the segment [l,r] of the array, then sum(l_1 β¦ r_1) < sum(l_2 β¦ r_2) < β¦ < sum(l_k β¦ r_k)).
Pchelenok also wants his gift to be as beautiful as possible, so he asks you to find the maximal value of k such that he can give Mila a gift!
Input
The first line contains a single integer t (1 β€ t β€ 100) β the number of test cases. The next 2 β
t lines contain the descriptions of test cases. The description of each test case consists of two lines.
The first line of each test case contains a single integer n (1 β€ n β€ 10^5) β the length of the array.
The second line contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ 10^9) β the elements of the array a.
It is guaranteed that the sum of n over all test cases does not exceed 10^5.
Output
For each test case, print the maximum possible value of k.
Example
Input
5
1
1
3
1 2 3
5
1 1 2 2 3
7
1 2 1 1 3 2 6
5
9 6 7 9 7
Output
1
1
2
3
1"
"This is an easier version of the problem with smaller constraints.
Korney Korneevich dag up an array a of length n. Korney Korneevich has recently read about the operation [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR), so he wished to experiment with it. For this purpose, he decided to find all integers x β₯ 0 such that there exists an increasing subsequence of the array a, in which the bitwise XOR of numbers is equal to x.
It didn't take a long time for Korney Korneevich to find all such x, and he wants to check his result. That's why he asked you to solve this problem!
A sequence s is a subsequence of a sequence b if s can be obtained from b by deletion of several (possibly, zero or all) elements.
A sequence s_1, s_2, β¦ , s_m is called increasing if s_1 < s_2 < β¦ < s_m.
Input
The first line contains a single integer n (1 β€ n β€ 10^5).
The second line contains n integers a_1, a_2, β¦, a_n (0 β€ a_i β€ 500) β the elements of the array a.
Output
In the first line print a single integer k β the number of found x values.
In the second line print k integers in increasing order x_1, x_2, β¦ x_k (0 β€ x_1 < β¦ < x_k) β found x values.
Examples
Input
4
4 2 2 4
Output
4
0 2 4 6
Input
8
1 0 1 7 12 5 3 2
Output
12
0 1 2 3 4 5 6 7 10 11 12 13
Note
In the first test case:
* To get value x = 0 it is possible to choose and empty subsequence
* To get value x = 2 it is possible to choose a subsequence [2]
* To get value x = 4 it is possible to choose a subsequence [4]
* To get value x = 6 it is possible to choose a subsequence [2, 4] "
"This is a harder version of the problem with bigger constraints.
Korney Korneevich dag up an array a of length n. Korney Korneevich has recently read about the operation [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR), so he wished to experiment with it. For this purpose, he decided to find all integers x β₯ 0 such that there exists an increasing subsequence of the array a, in which the bitwise XOR of numbers is equal to x.
It didn't take a long time for Korney Korneevich to find all such x, and he wants to check his result. That's why he asked you to solve this problem!
A sequence s is a subsequence of a sequence b if s can be obtained from b by deletion of several (possibly, zero or all) elements.
A sequence s_1, s_2, β¦ , s_m is called increasing if s_1 < s_2 < β¦ < s_m.
Input
The first line contains a single integer n (1 β€ n β€ 10^6).
The second line contains n integers a_1, a_2, β¦, a_n (0 β€ a_i β€ 5000) β the elements of the array a.
Output
In the first line print a single integer k β the number of found x values.
In the second line print k integers in increasing order x_1, x_2, β¦ x_k (0 β€ x_1 < β¦ < x_k) β found x values.
Examples
Input
4
4 2 2 4
Output
4
0 2 4 6
Input
8
1 0 1 7 12 5 3 2
Output
12
0 1 2 3 4 5 6 7 10 11 12 13
Note
In the first test case:
* To get value x = 0 it is possible to choose and empty subsequence
* To get value x = 2 it is possible to choose a subsequence [2]
* To get value x = 4 it is possible to choose a subsequence [4]
* To get value x = 6 it is possible to choose a subsequence [2, 4] "
"Kuzya started going to school. He was given math homework in which he was given an array a of length n and an array of symbols b of length n, consisting of symbols '*' and '/'.
Let's denote a path of calculations for a segment [l; r] (1 β€ l β€ r β€ n) in the following way:
* Let x=1 initially. For every i from l to r we will consequently do the following: if b_i= '*', x=x*a_i, and if b_i= '/', then x=(x)/(a_i). Let's call a path of calculations for the segment [l; r] a list of all x that we got during the calculations (the number of them is exactly r - l + 1).
For example, let a=[7, 12, 3, 5, 4, 10, 9], b=[/, *, /, /, /, *, *], l=2, r=6, then the path of calculations for that segment is [12, 4, 0.8, 0.2, 2].
Let's call a segment [l;r] simple if the path of calculations for it contains only integer numbers.
Kuzya needs to find the number of simple segments [l;r] (1 β€ l β€ r β€ n). Since he obviously has no time and no interest to do the calculations for each option, he asked you to write a program to get to find that number!
Input
The first line contains a single integer n (2 β€ n β€ 10^6).
The second line contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ 10^6).
The third line contains n symbols without spaces between them β the array b_1, b_2 β¦ b_n (b_i= '/' or b_i= '*' for every 1 β€ i β€ n).
Output
Print a single integer β the number of simple segments [l;r].
Examples
Input
3
1 2 3
*/*
Output
2
Input
7
6 4 10 1 2 15 1
*/*/*//
Output
8"
"A bow adorned with nameless flowers that bears the earnest hopes of an equally nameless person.
You have obtained the elegant bow known as the Windblume Ode. Inscribed in the weapon is an array of n (n β₯ 3) positive distinct integers (i.e. different, no duplicates are allowed).
Find the largest subset (i.e. having the maximum number of elements) of this array such that its sum is a composite number. A positive integer x is called composite if there exists a positive integer y such that 1 < y < x and x is divisible by y.
If there are multiple subsets with this largest size with the composite sum, you can output any of them. It can be proven that under the constraints of the problem such a non-empty subset always exists.
Input
Each test consists of multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 100). Description of the test cases follows.
The first line of each test case contains an integer n (3 β€ n β€ 100) β the length of the array.
The second line of each test case contains n distinct integers a_{1},a_{2},...,a_{n} (1 β€ a_{i} β€ 200) β the elements of the array.
Output
Each test case should have two lines of output.
The first line should contain a single integer x: the size of the largest subset with composite sum. The next line should contain x space separated integers representing the indices of the subset of the initial array.
Example
Input
4
3
8 1 2
4
6 9 4 2
9
1 2 3 4 5 6 7 8 9
3
200 199 198
Output
2
2 1
4
2 1 4 3
9
6 9 1 2 3 4 5 7 8
3
1 2 3
Note
In the first test case, the subset \\{a_2, a_1\} has a sum of 9, which is a composite number. The only subset of size 3 has a prime sum equal to 11. Note that you could also have selected the subset \\{a_1, a_3\} with sum 8 + 2 = 10, which is composite as it's divisible by 2.
In the second test case, the sum of all elements equals to 21, which is a composite number. Here we simply take the whole array as our subset."
"Lord Omkar would like to have a tree with n nodes (3 β€ n β€ 10^5) and has asked his disciples to construct the tree. However, Lord Omkar has created m (1 β€ m < n) restrictions to ensure that the tree will be as heavenly as possible.
A tree with n nodes is an connected undirected graph with n nodes and n-1 edges. Note that for any two nodes, there is exactly one simple path between them, where a simple path is a path between two nodes that does not contain any node more than once.
Here is an example of a tree:
<image>
A restriction consists of 3 pairwise distinct integers, a, b, and c (1 β€ a,b,c β€ n). It signifies that node b cannot lie on the simple path between node a and node c.
Can you help Lord Omkar and become his most trusted disciple? You will need to find heavenly trees for multiple sets of restrictions. It can be shown that a heavenly tree will always exist for any set of restrictions under the given constraints.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 10^4). Description of the test cases follows.
The first line of each test case contains two integers, n and m (3 β€ n β€ 10^5, 1 β€ m < n), representing the size of the tree and the number of restrictions.
The i-th of the next m lines contains three integers a_i, b_i, c_i (1 β€ a_i, b_i, c_i β€ n, a, b, c are distinct), signifying that node b_i cannot lie on the simple path between nodes a_i and c_i.
It is guaranteed that the sum of n across all test cases will not exceed 10^5.
Output
For each test case, output n-1 lines representing the n-1 edges in the tree. On each line, output two integers u and v (1 β€ u, v β€ n, u β v) signifying that there is an edge between nodes u and v. Given edges have to form a tree that satisfies Omkar's restrictions.
Example
Input
2
7 4
1 2 3
3 4 5
5 6 7
6 5 4
5 3
1 2 3
2 3 4
3 4 5
Output
1 2
1 3
3 5
3 4
2 7
7 6
5 1
1 3
3 2
2 4
Note
The output of the first sample case corresponds to the following tree:
<image> For the first restriction, the simple path between 1 and 3 is 1, 3, which doesn't contain 2. The simple path between 3 and 5 is 3, 5, which doesn't contain 4. The simple path between 5 and 7 is 5, 3, 1, 2, 7, which doesn't contain 6. The simple path between 6 and 4 is 6, 7, 2, 1, 3, 4, which doesn't contain 5. Thus, this tree meets all of the restrictions.
The output of the second sample case corresponds to the following tree:
<image>"
"The problem statement looms below, filling you with determination.
Consider a grid in which some cells are empty and some cells are filled. Call a cell in this grid exitable if, starting at that cell, you can exit the grid by moving up and left through only empty cells. This includes the cell itself, so all filled in cells are not exitable. Note that you can exit the grid from any leftmost empty cell (cell in the first column) by going left, and from any topmost empty cell (cell in the first row) by going up.
Let's call a grid determinable if, given only which cells are exitable, we can exactly determine which cells are filled in and which aren't.
You are given a grid a of dimensions n Γ m , i. e. a grid with n rows and m columns. You need to answer q queries (1 β€ q β€ 2 β
10^5). Each query gives two integers x_1, x_2 (1 β€ x_1 β€ x_2 β€ m) and asks whether the subgrid of a consisting of the columns x_1, x_1 + 1, β¦, x_2 - 1, x_2 is determinable.
Input
The first line contains two integers n, m (1 β€ n, m β€ 10^6, nm β€ 10^6) β the dimensions of the grid a.
n lines follow. The y-th line contains m characters, the x-th of which is 'X' if the cell on the intersection of the the y-th row and x-th column is filled and ""."" if it is empty.
The next line contains a single integer q (1 β€ q β€ 2 β
10^5) β the number of queries.
q lines follow. Each line contains two integers x_1 and x_2 (1 β€ x_1 β€ x_2 β€ m), representing a query asking whether the subgrid of a containing the columns x_1, x_1 + 1, β¦, x_2 - 1, x_2 is determinable.
Output
For each query, output one line containing ""YES"" if the subgrid specified by the query is determinable and ""NO"" otherwise. The output is case insensitive (so ""yEs"" and ""No"" will also be accepted).
Example
Input
4 5
..XXX
...X.
...X.
...X.
5
1 3
3 3
4 5
5 5
1 5
Output
YES
YES
NO
YES
NO
Note
For each query of the example, the corresponding subgrid is displayed twice below: first in its input format, then with each cell marked as ""E"" if it is exitable and ""N"" otherwise.
For the first query:
..X EEN
... EEE
... EEE
... EEE
For the second query:
X N
. E
. E
. E
Note that you can exit the grid by going left from any leftmost cell (or up from any topmost cell); you do not need to reach the top left corner cell to exit the grid.
For the third query:
XX NN
X. NN
X. NN
X. NN
This subgrid cannot be determined only from whether each cell is exitable, because the below grid produces the above ""exitability grid"" as well:
XX
XX
XX
XX
For the fourth query:
X N
. E
. E
. E
For the fifth query:
..XXX EENNN
...X. EEENN
...X. EEENN
...X. EEENN
This query is simply the entire grid. It cannot be determined only from whether each cell is exitable because the below grid produces the above ""exitability grid"" as well:
..XXX
...XX
...XX
...XX
"
"It turns out that the meaning of life is a permutation p_1, p_2, β¦, p_n of the integers 1, 2, β¦, n (2 β€ n β€ 100). Omkar, having created all life, knows this permutation, and will allow you to figure it out using some queries.
A query consists of an array a_1, a_2, β¦, a_n of integers between 1 and n. a is not required to be a permutation. Omkar will first compute the pairwise sum of a and p, meaning that he will compute an array s where s_j = p_j + a_j for all j = 1, 2, β¦, n. Then, he will find the smallest index k such that s_k occurs more than once in s, and answer with k. If there is no such index k, then he will answer with 0.
You can perform at most 2n queries. Figure out the meaning of life p.
Interaction
Start the interaction by reading single integer n (2 β€ n β€ 100) β the length of the permutation p.
You can then make queries. A query consists of a single line ""? \enspace a_1 \enspace a_2 \enspace β¦ \enspace a_n"" (1 β€ a_j β€ n).
The answer to each query will be a single integer k as described above (0 β€ k β€ n).
After making a query do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:
* fflush(stdout) or cout.flush() in C++;
* System.out.flush() in Java;
* flush(output) in Pascal;
* stdout.flush() in Python;
* see documentation for other languages.
To output your answer, print a single line ""! \enspace p_1 \enspace p_2 \enspace β¦ \enspace p_n"" then terminate.
You can make at most 2n queries. Outputting the answer does not count as a query.
Hack Format
To hack, first output a line containing n (2 β€ n β€ 100), then output another line containing the hidden permutation p_1, p_2, β¦, p_n of numbers from 1 to n.
Example
Input
5
2
0
1
Output
? 4 4 2 3 2
? 3 5 1 5 5
? 5 2 4 3 1
! 3 2 1 5 4
Note
In the sample, the hidden permutation p is [3, 2, 1, 5, 4]. Three queries were made.
The first query is a = [4, 4, 2, 3, 2]. This yields s = [3 + 4, 2 + 4, 1 + 2, 5 + 3, 4 + 2] = [7, 6, 3, 8, 6]. 6 is the only number that appears more than once, and it appears first at index 2, making the answer to the query 2.
The second query is a = [3, 5, 1, 5, 5]. This yields s = [3 + 3, 2 + 5, 1 + 1, 5 + 5, 4 + 5] = [6, 7, 2, 10, 9]. There are no numbers that appear more than once here, so the answer to the query is 0.
The third query is a = [5, 2, 4, 3, 1]. This yields s = [3 + 5, 2 + 2, 1 + 4, 5 + 3, 4 + 1] = [8, 4, 5, 8, 5]. 5 and 8 both occur more than once here. 5 first appears at index 3, while 8 first appears at index 1, and 1 < 3, making the answer to the query 1.
Note that the sample is only meant to provide an example of how the interaction works; it is not guaranteed that the above queries represent a correct strategy with which to determine the answer."
"She does her utmost to flawlessly carry out a person's last rites and preserve the world's balance of yin and yang.
Hu Tao, being the little prankster she is, has tried to scare you with this graph problem! You are given a connected undirected graph of n nodes with m edges. You also have q queries. Each query consists of two nodes a and b.
Initially, all edges in the graph have a weight of 0. For each query, you must choose a simple path starting from a and ending at b. Then you add 1 to every edge along this path. Determine if it's possible, after processing all q queries, for all edges in this graph to have an even weight. If so, output the choice of paths for each query.
If it is not possible, determine the smallest number of extra queries you could add to make it possible. It can be shown that this number will not exceed 10^{18} under the given constraints.
A simple path is defined as any path that does not visit a node more than once.
An edge is said to have an even weight if its value is divisible by 2.
Input
The first line contains two integers n and m (2 β€ n β€ 3 β
10^5, n-1 β€ m β€ min{\left((n(n-1))/(2), 3 β
10^5\right)}).
Each of the next m lines contains two integers x and y (1 β€ x, y β€ n, xβ y) indicating an undirected edge between node x and y. The input will not contain self-loops or duplicate edges, and the provided graph will be connected.
The next line contains a single integer q (1 β€ q β€ 3 β
10^5).
Each of the next q lines contains two integers a and b (1 β€ a, b β€ n, a β b), the description of each query.
It is guaranteed that nq β€ 3 β
10^5.
Output
If it is possible to force all edge weights to be even, print ""YES"" on the first line, followed by 2q lines indicating the choice of path for each query in the same order the queries are given. For each query, the first line should contain a single integer x: the number of nodes in the chosen path. The next line should then contain x spaced separated integers p_i indicating the path you take (p_1 = a, p_x = b and all numbers should fall between 1 and n). This path cannot contain duplicate nodes and must be a valid simple path in the graph.
If it is impossible to force all edge weights to be even, print ""NO"" on the first line and the minimum number of added queries on the second line.
Examples
Input
6 7
2 1
2 3
3 5
1 4
6 1
5 6
4 5
3
1 4
5 1
4 5
Output
YES
2
1 4
4
5 3 2 1
5
4 1 2 3 5
Input
5 7
4 3
4 5
2 1
1 4
1 3
3 5
3 2
4
4 2
3 5
5 1
4 5
Output
NO
2
Note
Here is what the queries look like for the first test case (red corresponds to the 1st query, blue 2nd query, and green 3rd query):
<image> Notice that every edge in the graph is part of either 0 or 2 colored query edges.
The graph in the second test case looks like this:
<image> There does not exist an assignment of paths that will force all edges to have even weights with the given queries. One must add at least 2 new queries to obtain a set of queries that can satisfy the condition."
"Even if you just leave them be, they will fall to pieces all by themselves. So, someone has to protect them, right?
You find yourself playing with Teucer again in the city of Liyue. As you take the eccentric little kid around, you notice something interesting about the structure of the city.
Liyue can be represented as a directed graph containing n nodes. Nodes are labeled from 1 to n. There is a directed edge from node a to node b if and only if a < b.
A path between nodes a and b is defined as a sequence of edges such that you can start at a, travel along all of these edges in the corresponding direction, and end at b. The length of a path is defined by the number of edges. A rainbow path of length x is defined as a path in the graph such that there exists at least 2 distinct colors among the set of x edges.
Teucer's favorite number is k. You are curious about the following scenario: If you were to label each edge with a color, what is the minimum number of colors needed to ensure that all paths of length k or longer are rainbow paths?
Teucer wants to surprise his older brother with a map of Liyue. He also wants to know a valid coloring of edges that uses the minimum number of colors. Please help him with this task!
Input
The only line of input contains two integers n and k (2 β€ k < n β€ 1000).
Output
On the first line, output c, the minimum colors you need to satisfy the above requirements.
On the second line, print a valid edge coloring as an array of (n(n-1))/(2) integers ranging from 1 to c. Exactly c distinct colors should exist in the construction. Print the edges in increasing order by the start node first, then by the second node.
For example, if n=4, the edge colors will correspond to this order of edges: (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)
Examples
Input
5 3
Output
2
1 2 2 2 2 2 2 1 1 1
Input
5 2
Output
3
3 2 2 1 2 2 1 3 1 1
Input
8 7
Output
2
2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Input
3 2
Output
2
1 2 2
Note
The corresponding construction for the first test case looks like this:
<image> It is impossible to satisfy the constraints with less than 2 colors.
The corresponding construction for the second test case looks like this:
<image> One can show there exists no construction using less than 3 colors."
"El Psy Kongroo.
Omkar is watching Steins;Gate.
In Steins;Gate, Okabe Rintarou needs to complete n tasks (1 β€ n β€ 2 β
10^5). Unfortunately, he doesn't know when he needs to complete the tasks.
Initially, the time is 0. Time travel will now happen according to the following rules:
* For each k = 1, 2, β¦, n, Okabe will realize at time b_k that he was supposed to complete the k-th task at time a_k (a_k < b_k).
* When he realizes this, if k-th task was already completed at time a_k, Okabe keeps the usual flow of time. Otherwise, he time travels to time a_k then immediately completes the task.
* If Okabe time travels to time a_k, all tasks completed after this time will become incomplete again. That is, for every j, if a_j>a_k, the j-th task will become incomplete, if it was complete (if it was incomplete, nothing will change).
* Okabe has bad memory, so he can time travel to time a_k only immediately after getting to time b_k and learning that he was supposed to complete the k-th task at time a_k. That is, even if Okabe already had to perform k-th task before, he wouldn't remember it before stumbling on the info about this task at time b_k again.
Please refer to the notes for an example of time travelling.
There is a certain set s of tasks such that the first moment that all of the tasks in s are simultaneously completed (regardless of whether any other tasks are currently completed), a funny scene will take place. Omkar loves this scene and wants to know how many times Okabe will time travel before this scene takes place. Find this number modulo 10^9 + 7. It can be proven that eventually all n tasks will be completed and so the answer always exists.
Input
The first line contains an integer n (1 β€ n β€ 2 β
10^5) β the number of tasks that Okabe needs to complete.
n lines follow. The k-th of these lines contain two integers a_k and b_k (1 β€ a_k < b_k β€ 2n) β the time at which Okabe needs to complete the k-th task and the time that he realizes this respectively. All 2n of these times are distinct (so every time from 1 to 2n inclusive appears exactly once in the input).
The next line contains a single integer t (1 β€ t β€ n) β the size of the set s of tasks that lead to the funny scene.
The last line contains t integers s_1, s_2, β¦, s_t β (1 β€ s_k β€ n, the numbers s_1, s_2, β¦, s_t are distinct) β the set s of tasks.
Output
Output a single integer β the number of times that Okabe time travels until all tasks in the set s are simultaneously completed, modulo 10^9 + 7.
Examples
Input
2
1 4
2 3
2
1 2
Output
3
Input
2
1 4
2 3
1
1
Output
2
Input
1
1 2
1
1
Output
1
Input
6
10 12
3 7
4 6
2 9
5 8
1 11
3
2 4 6
Output
17
Input
16
31 32
3 26
17 19
4 24
1 28
15 21
12 16
18 29
20 23
7 8
11 14
9 22
6 30
5 10
25 27
2 13
6
3 8 2 5 12 11
Output
138
Note
For the first sample, all tasks need to be completed in order for the funny scene to occur.
Initially, the time is 0. Nothing happens until time 3, when Okabe realizes that he should have done the 2-nd task at time 2. He then time travels to time 2 and completes the task.
As the task is done now, he does not time travel again when the time is again 3. However, at time 4, he travels to time 1 to complete the 1-st task.
This undoes the 2-nd task. This means that the 2-nd task is not currently completed, meaning that the funny scene will not occur at this point even though the 1-st task is currently completed and Okabe had previously completed the 2-nd task.
Once it is again time 3 he travels back to time 2 once more and does the 2-nd task again.
Now all tasks are complete, with Okabe having time travelled 3 times.
The second sample has the same tasks for Okabe to complete. However, this time the funny scene only needs the first task to be completed in order to occur. From reading the above sample you can see that this occurs once Okabe has time travelled 2 times."
"Omkar is hosting tours of his country, Omkarland! There are n cities in Omkarland, and, rather curiously, there are exactly n-1 bidirectional roads connecting the cities to each other. It is guaranteed that you can reach any city from any other city through the road network.
Every city has an enjoyment value e. Each road has a capacity c, denoting the maximum number of vehicles that can be on it, and an associated toll t. However, the toll system in Omkarland has an interesting quirk: if a vehicle travels on multiple roads on a single journey, they pay only the highest toll of any single road on which they traveled. (In other words, they pay max t over all the roads on which they traveled.) If a vehicle traverses no roads, they pay 0 toll.
Omkar has decided to host q tour groups. Each tour group consists of v vehicles starting at city x. (Keep in mind that a tour group with v vehicles can travel only on roads with capacity β₯ v.) Being the tour organizer, Omkar wants his groups to have as much fun as they possibly can, but also must reimburse his groups for the tolls that they have to pay. Thus, for each tour group, Omkar wants to know two things: first, what is the enjoyment value of the city y with maximum enjoyment value that the tour group can reach from their starting city, and second, how much per vehicle will Omkar have to pay to reimburse the entire group for their trip from x to y? (This trip from x to y will always be on the shortest path from x to y.)
In the case that there are multiple reachable cities with the maximum enjoyment value, Omkar will let his tour group choose which one they want to go to. Therefore, to prepare for all possible scenarios, he wants to know the amount of money per vehicle that he needs to guarantee that he can reimburse the group regardless of which city they choose.
Input
The first line contains two integers n and q (2 β€ n β€ 2 β
10^5, 1 β€ q β€ 2 β
10^5), representing the number of cities and the number of groups, respectively.
The next line contains n integers e_1, e_2, β¦, e_n (1 β€ e_i β€ 10^9), where e_i represents the enjoyment value for city i.
The next n-1 lines each contain four integers a, b, c, and t (1 β€ a,b β€ n, 1 β€ c β€ 10^9, 1 β€ t β€ 10^9), representing an road between city a and city b with capacity c and toll t.
The next q lines each contain two integers v and x (1 β€ v β€ 10^9, 1 β€ x β€ n), representing the number of vehicles in the tour group and the starting city, respectively.
Output
Output q lines. The i-th line should contain two integers: the highest possible enjoyment value of a city reachable by the i-th tour group, and the amount of money per vehicle Omkar needs to guarantee that he can reimburse the i-th tour group.
Examples
Input
5 3
2 2 3 3 3
1 2 4 7
1 3 2 8
2 4 8 2
2 5 1 1
1 3
9 5
6 2
Output
3 8
3 0
3 2
Input
5 5
1 2 3 4 5
1 2 4 1
1 3 3 1
1 4 2 1
2 5 1 1
5 1
4 1
3 1
2 1
1 1
Output
1 0
2 1
3 1
4 1
5 1
Input
5 5
1 2 2 2 2
1 2 5 8
1 3 6 3
1 4 4 5
1 5 7 1
4 1
5 1
6 1
7 1
8 1
Output
2 8
2 8
2 3
2 1
1 0
Note
A map of the first sample is shown below. For the nodes, unbolded numbers represent indices and bolded numbers represent enjoyment values. For the edges, unbolded numbers represent capacities and bolded numbers represent tolls.
<image>
For the first query, a tour group of size 1 starting at city 3 can reach cities 1, 2, 3, 4, and 5. Thus, the largest enjoyment value that they can reach is 3. If the tour group chooses to go to city 4, Omkar will have to pay 8 per vehicle, which is the maximum.
For the second query, a tour group of size 9 starting at city 5 can reach only city 5. Thus, the largest reachable enjoyment value is still 3, and Omkar will pay 0 per vehicle.
For the third query, a tour group of size 6 starting at city 2 can reach cities 2 and 4. The largest reachable enjoyment value is again 3. If the tour group chooses to go to city 4, Omkar will have to pay 2 per vehicle, which is the maximum.
A map of the second sample is shown below:
<image>
For the first query, a tour group of size 5 starting at city 1 can only reach city 1. Thus, their maximum enjoyment value is 1 and the cost Omkar will have to pay is 0 per vehicle.
For the second query, a tour group of size 4 starting at city 1 can reach cities 1 and 2. Thus, their maximum enjoyment value is 2 and Omkar will pay 1 per vehicle.
For the third query, a tour group of size 3 starting at city 1 can reach cities 1, 2, and 3. Thus, their maximum enjoyment value is 3 and Omkar will pay 1 per vehicle.
For the fourth query, a tour group of size 2 starting at city 1 can reach cities 1, 2, 3 and 4. Thus, their maximum enjoyment value is 4 and Omkar will pay 1 per vehicle.
For the fifth query, a tour group of size 1 starting at city 1 can reach cities 1, 2, 3, 4, and 5. Thus, their maximum enjoyment value is 5 and Omkar will pay 1 per vehicle."
"Omkar is creating a mosaic using colored square tiles, which he places in an n Γ n grid. When the mosaic is complete, each cell in the grid will have either a glaucous or sinoper tile. However, currently he has only placed tiles in some cells.
A completed mosaic will be a mastapeece if and only if each tile is adjacent to exactly 2 tiles of the same color (2 tiles are adjacent if they share a side.) Omkar wants to fill the rest of the tiles so that the mosaic becomes a mastapeece. Now he is wondering, is the way to do this unique, and if it is, what is it?
Input
The first line contains a single integer n (1 β€ n β€ 2000).
Then follow n lines with n characters in each line. The i-th character in the j-th line corresponds to the cell in row i and column j of the grid, and will be S if Omkar has placed a sinoper tile in this cell, G if Omkar has placed a glaucous tile, . if it's empty.
Output
On the first line, print UNIQUE if there is a unique way to get a mastapeece, NONE if Omkar cannot create any, and MULTIPLE if there is more than one way to do so. All letters must be uppercase.
If you print UNIQUE, then print n additional lines with n characters in each line, such that the i-th character in the j^{th} line is S if the tile in row i and column j of the mastapeece is sinoper, and G if it is glaucous.
Examples
Input
4
S...
..G.
....
...S
Output
MULTIPLE
Input
6
S.....
....G.
..S...
.....S
....G.
G.....
Output
NONE
Input
10
.S....S...
..........
...SSS....
..........
..........
...GS.....
....G...G.
..........
......G...
..........
Output
UNIQUE
SSSSSSSSSS
SGGGGGGGGS
SGSSSSSSGS
SGSGGGGSGS
SGSGSSGSGS
SGSGSSGSGS
SGSGGGGSGS
SGSSSSSSGS
SGGGGGGGGS
SSSSSSSSSS
Input
1
.
Output
NONE
Note
For the first test case, Omkar can make the mastapeeces
SSSS
SGGS
SGGS
SSSS
and
SSGG
SSGG
GGSS
GGSS.
For the second test case, it can be proven that it is impossible for Omkar to add tiles to create a mastapeece.
For the third case, it can be proven that the given mastapeece is the only mastapeece Omkar can create by adding tiles.
For the fourth test case, it's clearly impossible for the only tile in any mosaic Omkar creates to be adjacent to two tiles of the same color, as it will be adjacent to 0 tiles total. "
"Petya has got an interesting flower. Petya is a busy person, so he sometimes forgets to water it. You are given n days from Petya's live and you have to determine what happened with his flower in the end.
The flower grows as follows:
* If the flower isn't watered for two days in a row, it dies.
* If the flower is watered in the i-th day, it grows by 1 centimeter.
* If the flower is watered in the i-th and in the (i-1)-th day (i > 1), then it grows by 5 centimeters instead of 1.
* If the flower is not watered in the i-th day, it does not grow.
At the beginning of the 1-st day the flower is 1 centimeter tall. What is its height after n days?
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 100). Description of the test cases follows.
The first line of each test case contains the only integer n (1 β€ n β€ 100).
The second line of each test case contains n integers a_1, a_2, ..., a_n (a_i = 0 or a_i = 1). If a_i = 1, the flower is watered in the i-th day, otherwise it is not watered.
Output
For each test case print a single integer k β the flower's height after n days, or -1, if the flower dies.
Example
Input
4
3
1 0 1
3
0 1 1
4
1 0 0 1
1
0
Output
3
7
-1
1"
"You are given an array a of length n.
Let's define the eversion operation. Let x = a_n. Then array a is partitioned into two parts: left and right. The left part contains the elements of a that are not greater than x (β€ x). The right part contains the elements of a that are strictly greater than x (> x). The order of elements in each part is kept the same as before the operation, i. e. the partition is stable. Then the array is replaced with the concatenation of the left and the right parts.
For example, if the array a is [2, 4, 1, 5, 3], the eversion goes like this: [2, 4, 1, 5, 3] β [2, 1, 3], [4, 5] β [2, 1, 3, 4, 5].
We start with the array a and perform eversions on this array. We can prove that after several eversions the array a stops changing. Output the minimum number k such that the array stops changing after k eversions.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 100). Description of the test cases follows.
The first line contains a single integer n (1 β€ n β€ 2 β
10^5).
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9).
It is guaranteed that the sum of n over all test cases does not exceed 2 β
10^5.
Output
For each test case print a single integer k β the number of eversions after which the array stops changing.
Example
Input
3
5
2 4 1 5 3
5
5 3 2 4 1
4
1 1 1 1
Output
1
2
0
Note
Consider the fist example.
* The first eversion: a = [1, 4, 2, 5, 3], x = 3. [2, 4, 1, 5, 3] β [2, 1, 3], [4, 5] β [2, 1, 3, 4, 5].
* The second and following eversions: a = [2, 1, 3, 4, 5], x = 5. [2, 1, 3, 4, 5] β [2, 1, 3, 4, 5], [] β [2, 1, 3, 4, 5]. This eversion does not change the array, so the answer is 1.
Consider the second example.
* The first eversion: a = [5, 3, 2, 4, 1], x = 1. [5, 3, 2, 4, 1] β [1], [5, 3, 2, 4] β [1, 5, 3, 2, 4].
* The second eversion: a = [1, 5, 3, 2, 4], x = 4. [1, 5, 3, 2, 4] β [1, 3, 2, 4], [5] β [1, 3, 2, 4, 5].
* The third and following eversions: a = [1, 3, 2, 4, 5], x = 5. [1, 3, 2, 4, 5] β [1, 3, 2, 4, 5], [] β [1, 3, 2, 4, 5]. This eversion does not change the array, so the answer is 2. "
"A total of n depots are located on a number line. Depot i lies at the point x_i for 1 β€ i β€ n.
You are a salesman with n bags of goods, attempting to deliver one bag to each of the n depots. You and the n bags are initially at the origin 0. You can carry up to k bags at a time. You must collect the required number of goods from the origin, deliver them to the respective depots, and then return to the origin to collect your next batch of goods.
Calculate the minimum distance you need to cover to deliver all the bags of goods to the depots. You do not have to return to the origin after you have delivered all the bags.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 10 500). Description of the test cases follows.
The first line of each test case contains two integers n and k (1 β€ k β€ n β€ 2 β
10^5).
The second line of each test case contains n integers x_1, x_2, β¦, x_n (-10^9 β€ x_i β€ 10^9). It is possible that some depots share the same position.
It is guaranteed that the sum of n over all test cases does not exceed 2 β
10^5.
Output
For each test case, output a single integer denoting the minimum distance you need to cover to deliver all the bags of goods to the depots.
Example
Input
4
5 1
1 2 3 4 5
9 3
-5 -10 -15 6 5 8 3 7 4
5 3
2 2 3 3 3
4 2
1000000000 1000000000 1000000000 1000000000
Output
25
41
7
3000000000
Note
In the first test case, you can carry only one bag at a time. Thus, the following is a solution sequence that gives a minimum travel distance: 0 β 2 β 0 β 4 β 0 β 3 β 0 β 1 β 0 β 5, where each 0 means you go the origin and grab one bag, and each positive integer means you deliver the bag to a depot at this coordinate, giving a total distance of 25 units. It must be noted that there are other sequences that give the same distance.
In the second test case, you can follow the following sequence, among multiple such sequences, to travel minimum distance: 0 β 6 β 8 β 7 β 0 β 5 β 4 β 3 β 0 β (-5) β (-10) β (-15), with distance 41. It can be shown that 41 is the optimal distance for this test case."
"Petya has an array of integers a_1, a_2, β¦, a_n. He only likes sorted arrays. Unfortunately, the given array could be arbitrary, so Petya wants to sort it.
Petya likes to challenge himself, so he wants to sort array using only 3-cycles. More formally, in one operation he can pick 3 pairwise distinct indices i, j, and k (1 β€ i, j, k β€ n) and apply i β j β k β i cycle to the array a. It simultaneously places a_i on position j, a_j on position k, and a_k on position i, without changing any other element.
For example, if a is [10, 50, 20, 30, 40, 60] and he chooses i = 2, j = 1, k = 5, then the array becomes [\underline{50}, \underline{40}, 20, 30, \underline{10}, 60].
Petya can apply arbitrary number of 3-cycles (possibly, zero). You are to determine if Petya can sort his array a, i. e. make it non-decreasing.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 5 β
10^5). Description of the test cases follows.
The first line of each test case contains a single integer n (1 β€ n β€ 5 β
10^5) β the length of the array a.
The second line of each test case contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ n).
It is guaranteed that the sum of n over all test cases does not exceed 5 β
10^5.
Output
For each test case, print ""YES"" (without quotes) if Petya can sort the array a using 3-cycles, and ""NO"" (without quotes) otherwise. You can print each letter in any case (upper or lower).
Example
Input
7
1
1
2
2 2
2
2 1
3
1 2 3
3
2 1 3
3
3 1 2
4
2 1 4 3
Output
YES
YES
NO
YES
NO
YES
YES
Note
In the 6-th test case Petya can use the 3-cycle 1 β 3 β 2 β 1 to sort the array.
In the 7-th test case Petya can apply 1 β 3 β 2 β 1 and make a = [1, 4, 2, 3]. Then he can apply 2 β 4 β 3 β 2 and finally sort the array."
"Petya has a rooted tree with an integer written on each vertex. The vertex 1 is the root. You are to answer some questions about the tree.
A tree is a connected graph without cycles. A rooted tree has a special vertex called the root. The parent of a node v is the next vertex on the shortest path from v to the root.
Each question is defined by three integers v, l, and k. To get the answer to the question, you need to perform the following steps:
* First, write down the sequence of all integers written on the shortest path from the vertex v to the root (including those written in the v and the root).
* Count the number of times each integer occurs. Remove all integers with less than l occurrences.
* Replace the sequence, removing all duplicates and ordering the elements by the number of occurrences in the original list in increasing order. In case of a tie, you can choose the order of these elements arbitrary.
* The answer to the question is the k-th number in the remaining sequence. Note that the answer is not always uniquely determined, because there could be several orderings. Also, it is possible that the length of the sequence on this step is less than k, in this case the answer is -1.
For example, if the sequence of integers on the path from v to the root is [2, 2, 1, 7, 1, 1, 4, 4, 4, 4], l = 2 and k = 2, then the answer is 1.
Please answer all questions about the tree.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 10^6). Description of the test cases follows.
The first line of each test case contains two integers n, q (1 β€ n, q β€ 10^6) β the number of vertices in the tree and the number of questions.
The second line contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ n), where a_i is the number written on the i-th vertex.
The third line contains n-1 integers p_2, p_3, β¦, p_n (1 β€ p_i β€ n), where p_i is the parent of node i. It's guaranteed that the values p define a correct tree.
Each of the next q lines contains three integers v, l, k (1 β€ v, l, k β€ n) β descriptions of questions.
It is guaranteed that the sum of n and the sum of q over all test cases do not exceed 10^6.
Output
For each question of each test case print the answer to the question. In case of multiple answers, print any.
Example
Input
2
3 3
1 1 1
1 2
3 1 1
3 1 2
3 2 1
5 5
1 2 1 1 2
1 1 2 2
3 1 1
2 1 2
4 1 1
4 2 1
4 2 2
Output
1 -1 1
1 1 2 1 -1 "
"You are given an array of n positive integers a_1, a_2, β¦, a_n. Your task is to calculate the number of arrays of n positive integers b_1, b_2, β¦, b_n such that:
* 1 β€ b_i β€ a_i for every i (1 β€ i β€ n), and
* b_i β b_{i+1} for every i (1 β€ i β€ n - 1).
The number of such arrays can be very large, so print it modulo 998 244 353.
Input
The first line contains a single integer n (1 β€ n β€ 2 β
10^5) β the length of the array a.
The second line contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ 10^9).
Output
Print the answer modulo 998 244 353 in a single line.
Examples
Input
3
2 2 2
Output
2
Input
2
2 3
Output
4
Input
3
1 1 1
Output
0
Note
In the first test case possible arrays are [1, 2, 1] and [2, 1, 2].
In the second test case possible arrays are [1, 2], [1, 3], [2, 1] and [2, 3]."
"Theofanis has a riddle for you and if you manage to solve it, he will give you a Cypriot snack halloumi for free (Cypriot cheese).
You are given an integer n. You need to find two integers l and r such that -10^{18} β€ l < r β€ 10^{18} and l + (l + 1) + β¦ + (r - 1) + r = n.
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of test cases.
The first and only line of each test case contains a single integer n (1 β€ n β€ 10^{18}).
Output
For each test case, print the two integers l and r such that -10^{18} β€ l < r β€ 10^{18} and l + (l + 1) + β¦ + (r - 1) + r = n.
It can be proven that an answer always exists. If there are multiple answers, print any.
Example
Input
7
1
2
3
6
100
25
3000000000000
Output
0 1
-1 2
1 2
1 3
18 22
-2 7
999999999999 1000000000001
Note
In the first test case, 0 + 1 = 1.
In the second test case, (-1) + 0 + 1 + 2 = 2.
In the fourth test case, 1 + 2 + 3 = 6.
In the fifth test case, 18 + 19 + 20 + 21 + 22 = 100.
In the sixth test case, (-2) + (-1) + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 = 25."
"Theofanis really likes sequences of positive integers, thus his teacher (Yeltsa Kcir) gave him a problem about a sequence that consists of only special numbers.
Let's call a positive number special if it can be written as a sum of different non-negative powers of n. For example, for n = 4 number 17 is special, because it can be written as 4^0 + 4^2 = 1 + 16 = 17, but 9 is not.
Theofanis asks you to help him find the k-th special number if they are sorted in increasing order. Since this number may be too large, output it modulo 10^9+7.
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of test cases.
The first and only line of each test case contains two integers n and k (2 β€ n β€ 10^9; 1 β€ k β€ 10^9).
Output
For each test case, print one integer β the k-th special number in increasing order modulo 10^9+7.
Example
Input
3
3 4
2 12
105 564
Output
9
12
3595374
Note
For n = 3 the sequence is [1,3,4,9...]"
"Theofanis has a string s_1 s_2 ... s_n and a character c. He wants to make all characters of the string equal to c using the minimum number of operations.
In one operation he can choose a number x (1 β€ x β€ n) and for every position i, where i is not divisible by x, replace s_i with c.
Find the minimum number of operations required to make all the characters equal to c and the x-s that he should use in his operations.
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of test cases.
The first line of each test case contains the integer n (3 β€ n β€ 3 β
10^5) and a lowercase Latin letter c β the length of the string s and the character the resulting string should consist of.
The second line of each test case contains a string s of lowercase Latin letters β the initial string.
It is guaranteed that the sum of n over all test cases does not exceed 3 β
10^5.
Output
For each test case, firstly print one integer m β the minimum number of operations required to make all the characters equal to c.
Next, print m integers x_1, x_2, ..., x_m (1 β€ x_j β€ n) β the x-s that should be used in the order they are given.
It can be proved that under given constraints, an answer always exists. If there are multiple answers, print any.
Example
Input
3
4 a
aaaa
4 a
baaa
4 b
bzyx
Output
0
1
2
2
2 3
Note
Let's describe what happens in the third test case:
1. x_1 = 2: we choose all positions that are not divisible by 2 and replace them, i. e. bzyx β bzbx;
2. x_2 = 3: we choose all positions that are not divisible by 3 and replace them, i. e. bzbx β bbbb. "
"Theofanis started playing the new online game called ""Among them"". However, he always plays with Cypriot players, and they all have the same name: ""Andreas"" (the most common name in Cyprus).
In each game, Theofanis plays with n other players. Since they all have the same name, they are numbered from 1 to n.
The players write m comments in the chat. A comment has the structure of ""i j c"" where i and j are two distinct integers and c is a string (1 β€ i, j β€ n; i β j; c is either imposter or crewmate). The comment means that player i said that player j has the role c.
An imposter always lies, and a crewmate always tells the truth.
Help Theofanis find the maximum possible number of imposters among all the other Cypriot players, or determine that the comments contradict each other (see the notes for further explanation).
Note that each player has exactly one role: either imposter or crewmate.
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of test cases. Description of each test case follows.
The first line of each test case contains two integers n and m (1 β€ n β€ 2 β
10^5; 0 β€ m β€ 5 β
10^5) β the number of players except Theofanis and the number of comments.
Each of the next m lines contains a comment made by the players of the structure ""i j c"" where i and j are two distinct integers and c is a string (1 β€ i, j β€ n; i β j; c is either imposter or crewmate).
There can be multiple comments for the same pair of (i, j).
It is guaranteed that the sum of all n does not exceed 2 β
10^5 and the sum of all m does not exceed 5 β
10^5.
Output
For each test case, print one integer β the maximum possible number of imposters. If the comments contradict each other, print -1.
Example
Input
5
3 2
1 2 imposter
2 3 crewmate
5 4
1 3 crewmate
2 5 crewmate
2 4 imposter
3 4 imposter
2 2
1 2 imposter
2 1 crewmate
3 5
1 2 imposter
1 2 imposter
3 2 crewmate
3 2 crewmate
1 3 imposter
5 0
Output
2
4
-1
2
5
Note
In the first test case, imposters can be Andreas 2 and 3.
In the second test case, imposters can be Andreas 1, 2, 3 and 5.
In the third test case, comments contradict each other. This is because player 1 says that player 2 is an imposter, and player 2 says that player 1 is a crewmate. If player 1 is a crewmate, then he must be telling the truth, so player 2 must be an imposter. But if player 2 is an imposter then he must be lying, so player 1 can't be a crewmate. Contradiction."
"It is the easy version of the problem. The difference is that in this version, there are no nodes with already chosen colors.
Theofanis is starving, and he wants to eat his favorite food, sheftalia. However, he should first finish his homework. Can you help him with this problem?
You have a perfect binary tree of 2^k - 1 nodes β a binary tree where all vertices i from 1 to 2^{k - 1} - 1 have exactly two children: vertices 2i and 2i + 1. Vertices from 2^{k - 1} to 2^k - 1 don't have any children. You want to color its vertices with the 6 Rubik's cube colors (White, Green, Red, Blue, Orange and Yellow).
Let's call a coloring good when all edges connect nodes with colors that are neighboring sides in the Rubik's cube.
<image>| <image>
---|---
A picture of Rubik's cube and its 2D map.
More formally:
* a white node can not be neighboring with white and yellow nodes;
* a yellow node can not be neighboring with white and yellow nodes;
* a green node can not be neighboring with green and blue nodes;
* a blue node can not be neighboring with green and blue nodes;
* a red node can not be neighboring with red and orange nodes;
* an orange node can not be neighboring with red and orange nodes;
You want to calculate the number of the good colorings of the binary tree. Two colorings are considered different if at least one node is colored with a different color.
The answer may be too large, so output the answer modulo 10^9+7.
Input
The first and only line contains the integers k (1 β€ k β€ 60) β the number of levels in the perfect binary tree you need to color.
Output
Print one integer β the number of the different colorings modulo 10^9+7.
Examples
Input
3
Output
24576
Input
14
Output
934234
Note
In the picture below, you can see one of the correct colorings of the first example.
<image>"
"It is the hard version of the problem. The difference is that in this version, there are nodes with already chosen colors.
Theofanis is starving, and he wants to eat his favorite food, sheftalia. However, he should first finish his homework. Can you help him with this problem?
You have a perfect binary tree of 2^k - 1 nodes β a binary tree where all vertices i from 1 to 2^{k - 1} - 1 have exactly two children: vertices 2i and 2i + 1. Vertices from 2^{k - 1} to 2^k - 1 don't have any children. You want to color its vertices with the 6 Rubik's cube colors (White, Green, Red, Blue, Orange and Yellow).
Let's call a coloring good when all edges connect nodes with colors that are neighboring sides in the Rubik's cube.
<image>| <image>
---|---
A picture of Rubik's cube and its 2D map.
More formally:
* a white node can not be neighboring with white and yellow nodes;
* a yellow node can not be neighboring with white and yellow nodes;
* a green node can not be neighboring with green and blue nodes;
* a blue node can not be neighboring with green and blue nodes;
* a red node can not be neighboring with red and orange nodes;
* an orange node can not be neighboring with red and orange nodes;
However, there are n special nodes in the tree, colors of which are already chosen.
You want to calculate the number of the good colorings of the binary tree. Two colorings are considered different if at least one node is colored with a different color.
The answer may be too large, so output the answer modulo 10^9+7.
Input
The first line contains the integers k (1 β€ k β€ 60) β the number of levels in the perfect binary tree you need to color.
The second line contains the integer n (1 β€ n β€ min(2^k - 1, 2000)) β the number of nodes, colors of which are already chosen.
The next n lines contains integer v (1 β€ v β€ 2^k - 1) and string s β the index of the node and the color of the node (s is one of the white, yellow, green, blue, red and orange).
It is guaranteed that each node v appears in the input at most once.
Output
Print one integer β the number of the different colorings modulo 10^9+7.
Examples
Input
3
2
5 orange
2 white
Output
1024
Input
2
2
1 white
2 white
Output
0
Input
10
3
1 blue
4 red
5 orange
Output
328925088
Note
In the picture below, you can see one of the correct colorings of the first test example.
<image>"
"Theofanis decided to visit his uncle's farm. There are s animals and n animal pens on the farm. For utility purpose, animal pens are constructed in one row.
Uncle told Theofanis that a farm is lucky if you can distribute all animals in all pens in such a way that there are no empty pens and there is at least one continuous segment of pens that has exactly k animals in total.
Moreover, a farm is ideal if it's lucky for any distribution without empty pens.
Neither Theofanis nor his uncle knows if their farm is ideal or not. Can you help them to figure it out?
Input
The first line contains a single integer t (1 β€ t β€ 10^5) β the number of test cases.
The first and only line of each test case contains three integers s, n, and k (1 β€ s, n, k β€ 10^{18}; n β€ s).
Output
For each test case, print YES (case-insensitive), if the farm is ideal, or NO (case-insensitive) otherwise.
Example
Input
4
1 1 1
1 1 2
100 50 200
56220 47258 14497
Output
YES
NO
NO
YES
Note
For the first and the second test case, the only possible combination is [1] so there always will be a subsegment with 1 animal but not with 2 animals."
"Monocarp is playing a computer game. Now he wants to complete the first level of this game.
A level is a rectangular grid of 2 rows and n columns. Monocarp controls a character, which starts in cell (1, 1) β at the intersection of the 1-st row and the 1-st column.
Monocarp's character can move from one cell to another in one step if the cells are adjacent by side and/or corner. Formally, it is possible to move from cell (x_1, y_1) to cell (x_2, y_2) in one step if |x_1 - x_2| β€ 1 and |y_1 - y_2| β€ 1. Obviously, it is prohibited to go outside the grid.
There are traps in some cells. If Monocarp's character finds himself in such a cell, he dies, and the game ends.
To complete a level, Monocarp's character should reach cell (2, n) β at the intersection of row 2 and column n.
Help Monocarp determine if it is possible to complete the level.
Input
The first line contains a single integer t (1 β€ t β€ 100) β the number of test cases. Then the test cases follow. Each test case consists of three lines.
The first line contains a single integer n (3 β€ n β€ 100) β the number of columns.
The next two lines describe the level. The i-th of these lines describes the i-th line of the level β the line consists of the characters '0' and '1'. The character '0' corresponds to a safe cell, the character '1' corresponds to a trap cell.
Additional constraint on the input: cells (1, 1) and (2, n) are safe.
Output
For each test case, output YES if it is possible to complete the level, and NO otherwise.
Example
Input
4
3
000
000
4
0011
1100
4
0111
1110
6
010101
101010
Output
YES
YES
NO
YES
Note
Consider the example from the statement.
In the first test case, one of the possible paths is (1, 1) β (2, 2) β (2, 3).
In the second test case, one of the possible paths is (1, 1) β (1, 2) β (2, 3) β (2, 4).
In the fourth test case, one of the possible paths is (1, 1) β (2, 2) β (1, 3) β (2, 4) β (1, 5) β (2, 6)."
"n students attended the first meeting of the Berland SU programming course (n is even). All students will be divided into two groups. Each group will be attending exactly one lesson each week during one of the five working days (Monday, Tuesday, Wednesday, Thursday and Friday), and the days chosen for the groups must be different. Furthermore, both groups should contain the same number of students.
Each student has filled a survey in which they told which days of the week are convenient for them to attend a lesson, and which are not.
Your task is to determine if it is possible to choose two different week days to schedule the lessons for the group (the first group will attend the lesson on the first chosen day, the second group will attend the lesson on the second chosen day), and divide the students into two groups, so the groups have equal sizes, and for each student, the chosen lesson day for their group is convenient.
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of testcases.
Then the descriptions of t testcases follow.
The first line of each testcase contains one integer n (2 β€ n β€ 1 000) β the number of students.
The i-th of the next n lines contains 5 integers, each of them is 0 or 1. If the j-th integer is 1, then the i-th student can attend the lessons on the j-th day of the week. If the j-th integer is 0, then the i-th student cannot attend the lessons on the j-th day of the week.
Additional constraints on the input: for each student, at least one of the days of the week is convenient, the total number of students over all testcases doesn't exceed 10^5.
Output
For each testcase print an answer. If it's possible to divide the students into two groups of equal sizes and choose different days for the groups so each student can attend the lesson in the chosen day of their group, print ""YES"" (without quotes). Otherwise, print ""NO"" (without quotes).
Example
Input
2
4
1 0 0 1 0
0 1 0 0 1
0 0 0 1 0
0 1 0 1 0
2
0 0 0 1 0
0 0 0 1 0
Output
YES
NO
Note
In the first testcase, there is a way to meet all the constraints. For example, the first group can consist of the first and the third students, they will attend the lessons on Thursday (the fourth day); the second group can consist of the second and the fourth students, and they will attend the lessons on Tuesday (the second day).
In the second testcase, it is impossible to divide the students into groups so they attend the lessons on different days."
"Monocarp has got an array a consisting of n integers. Let's denote k as the mathematic mean of these elements (note that it's possible that k is not an integer).
The mathematic mean of an array of n elements is the sum of elements divided by the number of these elements (i. e. sum divided by n).
Monocarp wants to delete exactly two elements from a so that the mathematic mean of the remaining (n - 2) elements is still equal to k.
Your task is to calculate the number of pairs of positions [i, j] (i < j) such that if the elements on these positions are deleted, the mathematic mean of (n - 2) remaining elements is equal to k (that is, it is equal to the mathematic mean of n elements of the original array a).
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of testcases.
The first line of each testcase contains one integer n (3 β€ n β€ 2 β
10^5) β the number of elements in the array.
The second line contains a sequence of integers a_1, a_2, ..., a_n (0 β€ a_i β€ 10^{9}), where a_i is the i-th element of the array.
The sum of n over all testcases doesn't exceed 2 β
10^5.
Output
Print one integer β the number of pairs of positions [i, j] (i < j) such that if the elements on these positions are deleted, the mathematic mean of (n - 2) remaining elements is equal to k (that is, it is equal to the mathematic mean of n elements of the original array a).
Example
Input
4
4
8 8 8 8
3
50 20 10
5
1 4 7 3 5
7
1 2 3 4 5 6 7
Output
6
0
2
3
Note
In the first example, any pair of elements can be removed since all of them are equal.
In the second example, there is no way to delete two elements so the mathematic mean doesn't change.
In the third example, it is possible to delete the elements on positions 1 and 3, or the elements on positions 4 and 5."
"Monocarp is the coach of the Berland State University programming teams. He decided to compose a problemset for a training session for his teams.
Monocarp has n problems that none of his students have seen yet. The i-th problem has a topic a_i (an integer from 1 to n) and a difficulty b_i (an integer from 1 to n). All problems are different, that is, there are no two tasks that have the same topic and difficulty at the same time.
Monocarp decided to select exactly 3 problems from n problems for the problemset. The problems should satisfy at least one of two conditions (possibly, both):
* the topics of all three selected problems are different;
* the difficulties of all three selected problems are different.
Your task is to determine the number of ways to select three problems for the problemset.
Input
The first line contains a single integer t (1 β€ t β€ 50000) β the number of testcases.
The first line of each testcase contains an integer n (3 β€ n β€ 2 β
10^5) β the number of problems that Monocarp have.
In the i-th of the following n lines, there are two integers a_i and b_i (1 β€ a_i, b_i β€ n) β the topic and the difficulty of the i-th problem.
It is guaranteed that there are no two problems that have the same topic and difficulty at the same time.
The sum of n over all testcases doesn't exceed 2 β
10^5.
Output
Print the number of ways to select three training problems that meet either of the requirements described in the statement.
Example
Input
2
4
2 4
3 4
2 1
1 3
5
1 5
2 4
3 3
4 2
5 1
Output
3
10
Note
In the first example, you can take the following sets of three problems:
* problems 1, 2, 4;
* problems 1, 3, 4;
* problems 2, 3, 4.
Thus, the number of ways is equal to three."
"You are given a matrix, consisting of n rows and m columns. The rows are numbered top to bottom, the columns are numbered left to right.
Each cell of the matrix can be either free or locked.
Let's call a path in the matrix a staircase if it:
* starts and ends in the free cell;
* visits only free cells;
* has one of the two following structures:
1. the second cell is 1 to the right from the first one, the third cell is 1 to the bottom from the second one, the fourth cell is 1 to the right from the third one, and so on;
2. the second cell is 1 to the bottom from the first one, the third cell is 1 to the right from the second one, the fourth cell is 1 to the bottom from the third one, and so on.
In particular, a path, consisting of a single cell, is considered to be a staircase.
Here are some examples of staircases:
<image>
Initially all the cells of the matrix are free.
You have to process q queries, each of them flips the state of a single cell. So, if a cell is currently free, it makes it locked, and if a cell is currently locked, it makes it free.
Print the number of different staircases after each query. Two staircases are considered different if there exists such a cell that appears in one path and doesn't appear in the other path.
Input
The first line contains three integers n, m and q (1 β€ n, m β€ 1000; 1 β€ q β€ 10^4) β the sizes of the matrix and the number of queries.
Each of the next q lines contains two integers x and y (1 β€ x β€ n; 1 β€ y β€ m) β the description of each query.
Output
Print q integers β the i-th value should be equal to the number of different staircases after i queries. Two staircases are considered different if there exists such a cell that appears in one path and doesn't appear in the other path.
Examples
Input
2 2 8
1 1
1 1
1 1
2 2
1 1
1 2
2 1
1 1
Output
5
10
5
2
5
3
1
0
Input
3 4 10
1 4
1 2
2 3
1 2
2 3
3 2
1 3
3 4
1 3
3 1
Output
49
35
24
29
49
39
31
23
29
27
Input
1000 1000 2
239 634
239 634
Output
1332632508
1333333000"
"A bracket sequence is a string containing only characters ""("" and "")"". A regular bracket sequence (or, shortly, an RBS) is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters ""1"" and ""+"" between the original characters of the sequence. For example:
* bracket sequences ""()()"" and ""(())"" are regular (the resulting expressions are: ""(1)+(1)"" and ""((1+1)+1)"");
* bracket sequences "")("", ""("" and "")"" are not.
Let's denote the concatenation of two strings x and y as x+y. For example, ""()()"" + "")("" = ""()())("".
You are given n bracket sequences s_1, s_2, ..., s_n. You can rearrange them in any order (you can rearrange only the strings themselves, but not the characters in them).
Your task is to rearrange the strings in such a way that the string s_1 + s_2 + ... + s_n has as many non-empty prefixes that are RBS as possible.
Input
The first line contains a single integer n (1 β€ n β€ 20).
Then n lines follow, the i-th of them contains s_i β a bracket sequence (a string consisting of characters ""("" and/or "")"". All sequences s_i are non-empty, their total length does not exceed 4 β
10^5.
Output
Print one integer β the maximum number of non-empty prefixes that are RBS for the string s_1 + s_2 + ... + s_n, if the strings s_1, s_2, ..., s_n can be rearranged arbitrarily.
Examples
Input
2
(
)
Output
1
Input
4
()()())
(
(
)
Output
4
Input
1
(())
Output
1
Input
1
)(()
Output
0
Note
In the first example, you can concatenate the strings as follows: ""("" + "")"" = ""()"", the resulting string will have one prefix, that is an RBS: ""()"".
In the second example, you can concatenate the strings as follows: ""("" + "")"" + ""()()())"" + ""("" = ""()()()())("", the resulting string will have four prefixes that are RBS: ""()"", ""()()"", ""()()()"", ""()()()()"".
The third and the fourth examples contain only one string each, so the order is fixed."
"Let's call a positive integer good if there is no digit 0 in its decimal representation.
For an array of a good numbers a, one found out that the sum of some two neighboring elements is equal to x (i.e. x = a_i + a_{i + 1} for some i). x had turned out to be a good number as well.
Then the elements of the array a were written out one after another without separators into one string s. For example, if a = [12, 5, 6, 133], then s = 1256133.
You are given a string s and a number x. Your task is to determine the positions in the string that correspond to the adjacent elements of the array that have sum x. If there are several possible answers, you can print any of them.
Input
The first line contains the string s (2 β€ |s| β€ 5 β
10^5).
The second line contains an integer x (2 β€ x < 10^{200000}).
An additional constraint on the input: the answer always exists, i.e you can always select two adjacent substrings of the string s so that if you convert these substrings to integers, their sum is equal to x.
Output
In the first line, print two integers l_1, r_1, meaning that the first term of the sum (a_i) is in the string s from position l_1 to position r_1.
In the second line, print two integers l_2, r_2, meaning that the second term of the sum (a_{i + 1}) is in the string s from position l_2 to position r_2.
Examples
Input
1256133
17
Output
1 2
3 3
Input
9544715561
525
Output
2 3
4 6
Input
239923
5
Output
1 1
2 2
Input
1218633757639
976272
Output
2 7
8 13
Note
In the first example s[1;2] = 12 and s[3;3] = 5, 12+5=17.
In the second example s[2;3] = 54 and s[4;6] = 471, 54+471=525.
In the third example s[1;1] = 2 and s[2;2] = 3, 2+3=5.
In the fourth example s[2;7] = 218633 and s[8;13] = 757639, 218633+757639=976272."
"You are given an array A of length N weights of masses A_1, A_2...A_N. No two weights have the same mass. You can put every weight on one side of the balance (left or right). You don't have to put weights in order A_1,...,A_N. There is also a string S consisting of characters ""L"" and ""R"", meaning that after putting the i-th weight (not A_i, but i-th weight of your choice) left or right side of the balance should be heavier. Find the order of putting the weights on the balance such that rules of string S are satisfied.
Input
The first line contains one integer N (1 β€ N β€ 2*10^5) - the length of the array A The second line contains N distinct integers: A_1, A_2,...,A_N (1 β€ A_i β€ 10^9) - the weights given The third line contains string S of length N consisting only of letters ""L"" and ""R"" - string determining which side of the balance should be heavier after putting the i-th weight of your choice
Output
The output contains N lines. In every line, you should print one integer and one letter - integer representing the weight you are putting on the balance in that move and the letter representing the side of the balance where you are putting the weight. If there is no solution, print -1.
Example
Input
5
3 8 2 13 7
LLRLL
Output
3 L
2 R
8 R
13 L
7 L
Note
Explanation for the test case:
after the 1st weight: 3 L (left side is heavier)
after the 2nd weight: 2 R (left side is heavier)
after the 3rd weight: 8 R (right side is heavier)
after the 4th weight: 13 L (left side is heavier)
after the 5th weight: 7 L (left side is heavier)
So, the rules given by string S are fulfilled and our order of putting the weights is correct."
"Alice and Bob always had hard time choosing restaurant for the dinner. Previously they performed Eenie Meenie Miney Mo game, but eventually as their restaurant list grew, they had to create a new game. This new game starts as they write restaurant names on N cards and align the cards in one line. Before the game begins, they both choose starting card and starting direction they are going to. They take turns in order one after another. After each turn, they move one card in their current direction. If they reach the end or beginning of the line of cards they change direction. Once they meet in a card, the card is marked for removal and is removed the first moment they both leave the card.
<image> Example of how card is removed
They repeat this process until there is only one restaurant card left. Since there are a lot of restaurant cards, they are bored to simulate this process over and over and need your help to determine the last card that remains. Can you help them?
Input
The first line of the input is one integer T (1 β€ T β€ 10^{4}) representing number of test cases. Each test case contains 3 lines: The first line contains an integer N representing initial number of cards. Next line contains two integer values A,B (0 β€ A, B < N, 2 β€ N β€ 10^{18}) representing starting 0-based index of the card in the array. Last line contains two strings D_A, D_B β {""left"", ""right""} representing starting direction of their movement.
Output
The output contains T integer number β the 0-based index of the last card that remains for every test case in order.
Example
Input
1
4
0 1
left right
Output
0
Note
Note that since Alice is starting at the beginning of the line even though her initial direction is left, on her next move she will go right."
"Little Johnny Bubbles enjoys spending hours in front of his computer playing video games. His favorite game is Bubble Strike, fast-paced bubble shooting online game for two players.
Each game is set in one of the N maps, each having different terrain configuration. First phase of each game decides on which map the game will be played. The game system randomly selects three maps and shows them to the players. Each player must pick one of those three maps to be discarded. The game system then randomly selects one of the maps that were not picked by any of the players and starts the game.
Johnny is deeply enthusiastic about the game and wants to spend some time studying maps, thus increasing chances to win games played on those maps. However, he also needs to do his homework, so he does not have time to study all the maps. That is why he asked himself the following question: ""What is the minimum number of maps I have to study, so that the probability to play one of those maps is at least P""?
Can you help Johnny find the answer for this question? You can assume Johnny's opponents do not know him, and they will randomly pick maps.
Input
The first line contains two integers N (3 β€ N β€ 10^{3}) and P (0 β€ P β€ 1) β total number of maps in the game and probability to play map Johnny has studied. P will have at most four digits after the decimal point.
Output
Output contains one integer number β minimum number of maps Johnny has to study.
Example
Input
7 1.0000
Output
6"
"There are N bubbles in a coordinate plane. Bubbles are so tiny that it can be assumed that each bubble is a point (X_i, Y_i).
Q Bubble Cup finalists plan to play with the bubbles. Each finalist would link to use infinitely long Bubble Cup stick to pop some bubbles. The i-th finalist would like to place the stick in the direction of vector (dxi, dyi), and plays the following game until K_i bubbles are popped. The game starts with finalist placing the stick in the direction of vector (dx_i, dy_i), and sweeping it from the infinity to the left until it hits some bubble, which is immediately popped. It is guaranteed that only one bubble will be hit in this step. After that the finalist starts rotating the stick in the counter clockwise direction with the center of rotation in point where the previous bubble was popped. When the next bubble is hit, it is immediately popped and becomes the new center of rotation. The process continues until K_i bubbles have been popped. It is guaranteed that the stick won't hit two bubbles simultaneously in this process.
For each finalist find which bubble would be popped the last. Note that each game starts with the configuration of all N bubbles, so the games don't depend on the previous games.
Input
The first line contains one integer N β the number of bubbles. (1 β€ N β€ 10^5)
Each of the next N lines contains two integers. The i-th line contains integers X_i and Y_i β the coordinates of the i-th bubble. (-10^9 β€ X_i, Y_i β€ 10^9, (X_i, Y_i) β (X_j, Y_j) for i β j)
The next line contains one integer Q β the number of finalists willing to play with the bubbles. (1 β€ Q β€ 10^5)
Each of the next Q lines contains 3 integers. The i-th line contains integers dx_i, dy_i and K_i. (-10^9 β€ dx_i, dy_i β€ 10^9, 1 β€ K_i β€ N)
Output
For each of the Q finalists, print the index of the bubble which would be popped last, in the separate line.
Examples
Input
4
0 0
1 0
0 1
1 1
2
1 -1 3
-1 1 4
Output
4
2
Input
4
1 1
2 2
7 1
1 7
3
2 2 1
1 -5 4
-6 5 3
Output
3
2
3
Note
There are two finalists willing to play with the bubbles. If the first finalist plays with the bubbles, then the bubbles at coordinates (0, 0), (1, 0) and (1, 1) would be popped in that order. Their indexes are 1, 2 and 4, so the answer is 4. If the second finalist plays with the bubbles, then the bubbles at coordinates (1, 1), (0, 1), (0, 0) and (1, 0) would be popped in that order, so the answer is 2.
Visualization: [link](https://petljamediastorage.blob.core.windows.net/uploads/example1.gif). "
"You are given two integer arrays of length N, A1 and A2. You are also given Q queries of 4 types:
1 k l r x: set Ak_i:=min(Ak_i, x) for each l β€ i β€ r.
2 k l r x: set Ak_i:=max(Ak_i, x) for each l β€ i β€ r.
3 k l r x: set Ak_i:=Ak_i+x for each l β€ i β€ r.
4 l r: find the (β_{i=l}^r F(A1_i+A2_i)) \% (10^9+7) where F(k) is the k-th Fibonacci number (F(0)=0, F(1)=1, F(k)=F(k-1)+F(k-2)), and x \% y denotes the remainder of the division of x by y.
You should process these queries and answer each query of the fourth type.
Input
The first line contains two integers N and Q. (1 β€ N, Q β€ 5 Γ 10^4)
The second line contains N integers, array A1_1, A1_2, ... A1_N. (0 β€ A1_i β€ 10^6)
The third line contains N integers, array A2_1, A2_2, ... A2_N. (0 β€ A2_i β€ 10^6)
The next Q lines describe the queries. Each line contains 5 or 3 integers, where the first integer denotes the type of the query. (k β \{1, 2\}, 1 β€ l β€ r β€ N)
For queries of type 1 and 2, 0 β€ x β€ 10^9 holds.
For queries of type 3, β10^6 β€ x β€ 10^6 holds.
It is guaranteed that after every query each number in arrays A1 and A2 will be nonnegative.
Output
Print the answer to each query of the fourth type, in separate lines.
Examples
Input
3 4
1 0 2
2 1 0
4 1 3
3 2 2 2 3
1 1 1 3 0
4 1 3
Output
4
4
Input
5 4
1 3 5 3 2
4 2 1 3 3
4 1 3
4 2 5
2 1 2 4 6
4 2 4
Output
18
26
68
Note
In the first example: The answer for the first query is F(1 + 2) + F(0 + 1) + F(2 + 0) = F(3) + F(1) + F(2) = 2 + 1 + 1 = 4. After the second query, the array A2 changes to [2, 4, 0]. After the third query, the array A1 changes to [0, 0, 0]. The answer for the fourth query is F(0 + 2) + F(0 + 4) + F(0 + 0) = F(2) + F(4) + F(0) = 1 + 3 + 0 = 4.
In the second example: The answer for the first query is F(1 + 4) + F(3 + 2) + F(5 + 1) = F(5) + F(5) + F(6) = 5 + 5 + 8 = 18. The answer for the second query is F(3 + 2) + F(5 + 1) + F(3 + 3) + F(2 + 3) = F(5) + F(6) + F(6) + F(5) = 5 + 8 + 8 + 5 = 26. After the third query, the array A1 changes to [1, 6, 6, 6, 2]. The answer for the fourth query is F(6 + 2) + F(6 + 1) + F(6 + 3) = F(8) + F(7) + F(9) = 21 + 13 + 34 = 68. "
"In the year 2420 humans have finally built a colony on Mars thanks to the work of Elon Tusk. There are 10^9+7 cities arranged in a circle in this colony and none of them are connected yet. Elon Tusk wants to connect some of those cities using only roads of the same size in order to lower the production cost of those roads. Because of that he gave a list on N cites where some cites can appear more than once and Q queries that you need to answer. For the query you need to determine if it is possible to connect all the cities from L_{i} to R_{i} on that list using only roads of length D_{i}.
Input
The first line contains two integers N and Q (1 β€ N, Q β€ 2β
10^5 ) β the length of the array of cities and the number of queries you need to answer.
The second lines contains N integers representing the array of cites. Next Q lines contain three integers L, R and D (1 β€ L_{i}, R_{i} β€ N, 0 β€ D_{i} β€ 10^9+6) β the range of cities that needs to be connected and the length of the road that you can use.
Output
The output contains Q lines. If it is possible to connect all the cities from the i-th query can be connected with roads of length D_{i} the i-th line should contain the word ""Yes"", otherwise it should contain the word ""No"".
Examples
Input
9 8
17 0 12 6 10 8 2 4 5
2 3 12
2 3 6
2 4 6
4 6 2
2 8 2
1 2 17
1 8 2
9 9 14
Output
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Input
4 1
7 21 14 0
1 4 1000000000
Output
Yes
Note
In the 5^{th} query of the first test case we can connect cities in this order 0-2-4-6-8-10-12 this way distance between any two connected cities is 2. In the second test case we can connect cities in this order 21-14-7-0 this way distance between any two connected cities is 10^9 module 10^9+7. "
"You are given N points on an infinite plane with the Cartesian coordinate system on it. N-1 points lay on one line, and one point isn't on that line. You are on point K at the start, and the goal is to visit every point. You can move between any two points in a straight line, and you can revisit points. What is the minimum length of the path?
Input
The first line contains two integers: N (3 β€ N β€ 2*10^5) - the number of points, and K (1 β€ K β€ N) - the index of the starting point.
Each of the next N lines contain two integers, A_i, B_i (-10^6 β€ A_i, B_i β€ 10^6) - coordinates of the i-th point.
Output
The output contains one number - the shortest path to visit all given points starting from point K. The absolute difference between your solution and the main solution shouldn't exceed 10^-6;
Example
Input
5 2
0 0
-1 1
2 -2
0 1
-2 2
Output
7.478709
Note
The shortest path consists of these moves:
2 -> 5
5 -> 4
4 -> 1
1 -> 3
There isn't any shorter path possible."
"This is an interactive problem!
As part of your contribution in the Great Bubble War, you have been tasked with finding the newly built enemy fortress. The world you live in is a giant 10^9 Γ 10^9 grid, with squares having both coordinates between 1 and 10^9.
You know that the enemy base has the shape of a rectangle, with the sides parallel to the sides of the grid. The people of your world are extremely scared of being at the edge of the world, so you know that the base doesn't contain any of the squares on the edges of the grid (the x or y coordinate being 1 or 10^9).
To help you locate the base, you have been given a device that you can place in any square of the grid, and it will tell you the manhattan distance to the closest square of the base. The manhattan distance from square (a, b) to square (p, q) is calculated as |aβp|+|bβq|. If you try to place the device inside the enemy base, you will be captured by the enemy. Because of this, you need to make sure to never place the device inside the enemy base.
Unfortunately, the device is powered by a battery and you can't recharge it. This means that you can use the device at most 40 times.
Input
The input contains the answers to your queries.
Interaction
Your code is allowed to place the device on any square in the grid by writing ""? i j"" (1 β€ i,j β€ 10^9). In return, it will recieve the manhattan distance to the closest square of the enemy base from square (i,j) or -1 if the square you placed the device on is inside the enemy base or outside the grid.
If you recieve -1 instead of a positive number, exit immidiately and you will see the wrong answer verdict. Otherwise, you can get an arbitrary verdict because your solution will continue to read from a closed stream.
Your solution should use no more than 40 queries.
Once you are sure where the enemy base is located, you should print ""! x y p q"" (1 β€ x β€ pβ€ 10^9, 1 β€ y β€ qβ€ 10^9), where (x, y) is the square inside the enemy base with the smallest x and y coordinates, and (p, q) is the square inside the enemy base with the largest x and y coordinates. Note that answering doesn't count as one of the 40 queries.
After printing a query or printing the answer, do not forget to output end of line and flush the output. Otherwise, you will get idleness limit exceeded. To do this, use:
* fflush(stdout) or cout.flush() in C++;
* System.out.flush() in Java;
* flush(output) in Pascal;
* stdout.flush() in Python;
* See the documentation for other languages.
Example
Input
1
1
2
1
Output
? 2 2
? 5 5
? 4 7
? 1 5
! 2 3 4 5"
"You are given an undirected graph of N nodes and M edges, E_1, E_2, ... E_M.
A connected graph is a cactus if each of it's edges belogs to at most one simple cycle. A graph is a desert if each of it's connected components is a cactus.
Find the number of pairs (L, R), (1 β€ L β€ R β€ M) such that, if we delete all the edges except for E_L, E_{L+1}, ... E_R, the graph is a desert.
Input
The first line contains two integers N and M (2 β€ N β€ 2.5 Γ 10^5, 1 β€ M β€ 5 Γ 10^5). Each of the next M lines contains two integers. The i-th line describes the i-th edge. It contains integers U_i and V_i, the nodes connected by the i-th edge (E_i=(U_i, V_i)). It is guaranteed that 1 β€ U_i, V_i β€ N and U_i β V_i.
Output
The output contains one integer number β the answer.
Examples
Input
5 6
1 2
2 3
3 4
4 5
5 1
2 4
Output
20
Input
2 3
1 2
1 2
1 2
Output
5
Note
In the second example: Graphs for pairs (1, 1), (2, 2) and (3, 3) are deserts because they don't have any cycles. Graphs for pairs (1, 2) and (2, 3) have one cycle of length 2 so they are deserts."
"Bob really likes playing with arrays of numbers. That's why for his birthday, his friends bought him a really interesting machine β an array beautifier.
The array beautifier takes an array A consisting of N integers, and it outputs a new array B of length N that it constructed based on the array given to it. The array beautifier constructs the new array in the following way: it takes two numbers at different indices from the original array and writes their sum to the end of the new array. It does this step N times - resulting in an output array of length N. During this process, the machine can take the same index multiple times in different steps.
Bob was very excited about the gift that his friends gave him, so he put his favorite array in the machine. However, when the machine finished, Bob was not happy with the resulting array. He misses his favorite array very much, and hopes to get it back.
Given the array that the machine outputted, help Bob find an array that could be the original array that he put in the machine. Sometimes the machine makes mistakes, so it is possible that no appropriate input array exists for the array it has outputted. In such case, let Bob know that his array is forever lost.
Input
The first line contains one positive integer N (2 β€ N β€ 10^3) β the length of Bob's array.
The second line contains N integers B_1, B_2, ..., B_N (1 β€ B_i β€ 10^6) β the elements of the array the machine outputted.
Output
If an appropriate input array exists, print ""YES"", followed by the input array A_1, A_2, ..., A_N (-10^9 β€ A_i β€ 10^9) in the next line. Otherwise, print ""NO"".
Examples
Input
2
5 5
Output
YES
2 3
Input
3
1 2 3
Output
YES
0 1 2
Input
3
2 4 5
Output
NO
Input
4
1 3 5 7
Output
YES
6 -3 4 1"
"Alice and Bob are playing a game. They are given an array A of length N. The array consists of integers. They are building a sequence together. In the beginning, the sequence is empty. In one turn a player can remove a number from the left or right side of the array and append it to the sequence. The rule is that the sequence they are building must be strictly increasing. The winner is the player that makes the last move. Alice is playing first. Given the starting array, under the assumption that they both play optimally, who wins the game?
Input
The first line contains one integer N (1 β€ N β€ 2*10^5) - the length of the array A.
The second line contains N integers A_1, A_2,...,A_N (0 β€ A_i β€ 10^9)
Output
The first and only line of output consists of one string, the name of the winner. If Alice won, print ""Alice"", otherwise, print ""Bob"".
Examples
Input
1
5
Output
Alice
Input
3
5 4 5
Output
Alice
Input
6
5 8 2 1 10 9
Output
Bob"
"On the great island of Baltia, there live N people, numbered from 1 to N. There are exactly M pairs of people that are friends with each other. The people of Baltia want to organize a successful party, but they have very strict rules on what a party is and when the party is successful. On the island of Baltia, a party is a gathering of exactly 5 people. The party is considered to be successful if either all the people at the party are friends with each other (so that they can all talk to each other without having to worry about talking to someone they are not friends with) or no two people at the party are friends with each other (so that everyone can just be on their phones without anyone else bothering them). Please help the people of Baltia organize a successful party or tell them that it's impossible to do so.
Input
The first line contains two integer numbers, N (5 β€ N β€ 2*10^5) and M (0 β€ M β€ 2*10^5) β the number of people that live in Baltia, and the number of friendships. The next M lines each contains two integers U_i and V_i (1 β€ U_i,V_i β€ N) β meaning that person U_i is friends with person V_i. Two friends can not be in the list of friends twice (no pairs are repeated) and a person can be friends with themselves (U_i β V_i).
Output
If it's possible to organize a successful party, print 5 numbers indicating which 5 people should be invited to the party. If it's not possible to organize a successful party, print -1 instead. If there are multiple successful parties possible, print any.
Examples
Input
6 3
1 4
4 2
5 4
Output
1 2 3 5 6
Input
5 4
1 2
2 3
3 4
4 5
Output
-1"
"You have received data from a Bubble bot. You know your task is to make factory facilities, but before you even start, you need to know how big the factory is and how many rooms it has. When you look at the data you see that you have the dimensions of the construction, which is in rectangle shape: N x M.
Then in the next N lines you have M numbers. These numbers represent factory tiles and they can go from 0 to 15. Each of these numbers should be looked in its binary form. Because from each number you know on which side the tile has walls. For example number 10 in it's binary form is 1010, which means that it has a wall from the North side, it doesn't have a wall from the East, it has a wall on the South side and it doesn't have a wall on the West side. So it goes North, East, South, West.
It is guaranteed that the construction always has walls on it's edges. The input will be correct.
Your task is to print the size of the rooms from biggest to smallest.
Input
The first line has two numbers which are N and M, the size of the construction. Both are integers:
n (1 β€ n β€ 10^3)
m (1 β€ m β€ 10^3)
Next N x M numbers represent each tile of construction.
Output
Once you finish processing the data your output consists of one line sorted from biggest to smallest room sizes.
Example
Input
4 5
9 14 11 12 13
5 15 11 6 7
5 9 14 9 14
3 2 14 3 14
Output
9 4 4 2 1 "
"You are given array a_1, a_2, β¦, a_n, consisting of non-negative integers.
Let's define operation of ""elimination"" with integer parameter k (1 β€ k β€ n) as follows:
* Choose k distinct array indices 1 β€ i_1 < i_2 < β¦ < i_k β€ n.
* Calculate x = a_{i_1} ~ \& ~ a_{i_2} ~ \& ~ β¦ ~ \& ~ a_{i_k}, where \& denotes the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND) (notes section contains formal definition).
* Subtract x from each of a_{i_1}, a_{i_2}, β¦, a_{i_k}; all other elements remain untouched.
Find all possible values of k, such that it's possible to make all elements of array a equal to 0 using a finite number of elimination operations with parameter k. It can be proven that exists at least one possible k for any array a.
Note that you firstly choose k and only after that perform elimination operations with value k you've chosen initially.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 10^4). Description of the test cases follows.
The first line of each test case contains one integer n (1 β€ n β€ 200 000) β the length of array a.
The second line of each test case contains n integers a_1, a_2, β¦, a_n (0 β€ a_i < 2^{30}) β array a itself.
It's guaranteed that the sum of n over all test cases doesn't exceed 200 000.
Output
For each test case, print all values k, such that it's possible to make all elements of a equal to 0 in a finite number of elimination operations with the given parameter k.
Print them in increasing order.
Example
Input
5
4
4 4 4 4
4
13 7 25 19
6
3 5 3 1 7 1
1
1
5
0 0 0 0 0
Output
1 2 4
1 2
1
1
1 2 3 4 5
Note
In the first test case:
* If k = 1, we can make four elimination operations with sets of indices \{1\}, \{2\}, \{3\}, \{4\}. Since \& of one element is equal to the element itself, then for each operation x = a_i, so a_i - x = a_i - a_i = 0.
* If k = 2, we can make two elimination operations with, for example, sets of indices \{1, 3\} and \{2, 4\}: x = a_1 ~ \& ~ a_3 = a_2 ~ \& ~ a_4 = 4 ~ \& ~ 4 = 4. For both operations x = 4, so after the first operation a_1 - x = 0 and a_3 - x = 0, and after the second operation β a_2 - x = 0 and a_4 - x = 0.
* If k = 3, it's impossible to make all a_i equal to 0. After performing the first operation, we'll get three elements equal to 0 and one equal to 4. After that, all elimination operations won't change anything, since at least one chosen element will always be equal to 0.
* If k = 4, we can make one operation with set \{1, 2, 3, 4\}, because x = a_1 ~ \& ~ a_2 ~ \& ~ a_3 ~ \& ~ a_4 = 4.
In the second test case, if k = 2 then we can make the following elimination operations:
* Operation with indices \{1, 3\}: x = a_1 ~ \& ~ a_3 = 13 ~ \& ~ 25 = 9. a_1 - x = 13 - 9 = 4 and a_3 - x = 25 - 9 = 16. Array a will become equal to [4, 7, 16, 19].
* Operation with indices \{3, 4\}: x = a_3 ~ \& ~ a_4 = 16 ~ \& ~ 19 = 16. a_3 - x = 16 - 16 = 0 and a_4 - x = 19 - 16 = 3. Array a will become equal to [4, 7, 0, 3].
* Operation with indices \{2, 4\}: x = a_2 ~ \& ~ a_4 = 7 ~ \& ~ 3 = 3. a_2 - x = 7 - 3 = 4 and a_4 - x = 3 - 3 = 0. Array a will become equal to [4, 4, 0, 0].
* Operation with indices \{1, 2\}: x = a_1 ~ \& ~ a_2 = 4 ~ \& ~ 4 = 4. a_1 - x = 4 - 4 = 0 and a_2 - x = 4 - 4 = 0. Array a will become equal to [0, 0, 0, 0].
Formal definition of bitwise AND:
Let's define bitwise AND (\&) as follows. Suppose we have two non-negative integers x and y, let's look at their binary representations (possibly, with leading zeroes): x_k ... x_2 x_1 x_0 and y_k ... y_2 y_1 y_0. Here, x_i is the i-th bit of number x, and y_i is the i-th bit of number y. Let r = x ~ \& ~ y is a result of operation \& on number x and y. Then binary representation of r will be r_k ... r_2 r_1 r_0, where:
$$$ r_i = \begin{cases} 1, ~ if ~ x_i = 1 ~ and ~ y_i = 1 \\\ 0, ~ if ~ x_i = 0 ~ or ~ y_i = 0 \end{cases} $$$"
"Frog Gorf is traveling through Swamp kingdom. Unfortunately, after a poor jump, he fell into a well of n meters depth. Now Gorf is on the bottom of the well and has a long way up.
The surface of the well's walls vary in quality: somewhere they are slippery, but somewhere have convenient ledges. In other words, if Gorf is on x meters below ground level, then in one jump he can go up on any integer distance from 0 to a_x meters inclusive. (Note that Gorf can't jump down, only up).
Unfortunately, Gorf has to take a break after each jump (including jump on 0 meters). And after jumping up to position x meters below ground level, he'll slip exactly b_x meters down while resting.
Calculate the minimum number of jumps Gorf needs to reach ground level.
Input
The first line contains a single integer n (1 β€ n β€ 300 000) β the depth of the well.
The second line contains n integers a_1, a_2, β¦, a_n (0 β€ a_i β€ i), where a_i is the maximum height Gorf can jump from i meters below ground level.
The third line contains n integers b_1, b_2, β¦, b_n (0 β€ b_i β€ n - i), where b_i is the distance Gorf will slip down if he takes a break on i meters below ground level.
Output
If Gorf can't reach ground level, print -1. Otherwise, firstly print integer k β the minimum possible number of jumps.
Then print the sequence d_1,\,d_2, β¦,\,d_k where d_j is the depth Gorf'll reach after the j-th jump, but before he'll slip down during the break. Ground level is equal to 0.
If there are multiple answers, print any of them.
Examples
Input
3
0 2 2
1 1 0
Output
2
1 0
Input
2
1 1
1 0
Output
-1
Input
10
0 1 2 3 5 5 6 7 8 5
9 8 7 1 5 4 3 2 0 0
Output
3
9 4 0
Note
In the first example, Gorf is on the bottom of the well and jump to the height 1 meter below ground level. After that he slip down by meter and stays on height 2 meters below ground level. Now, from here, he can reach ground level in one jump.
In the second example, Gorf can jump to one meter below ground level, but will slip down back to the bottom of the well. That's why he can't reach ground level.
In the third example, Gorf can reach ground level only from the height 5 meters below the ground level. And Gorf can reach this height using a series of jumps 10 β 9 \dashrightarrow 9 β 4 \dashrightarrow 5 where β is the jump and \dashrightarrow is slipping during breaks."
"You are given two arrays of integers a_1, a_2, β¦, a_n and b_1, b_2, β¦, b_m.
You need to insert all elements of b into a in an arbitrary way. As a result you will get an array c_1, c_2, β¦, c_{n+m} of size n + m.
Note that you are not allowed to change the order of elements in a, while you can insert elements of b at arbitrary positions. They can be inserted at the beginning, between any elements of a, or at the end. Moreover, elements of b can appear in the resulting array in any order.
What is the minimum possible number of inversions in the resulting array c? Recall that an inversion is a pair of indices (i, j) such that i < j and c_i > c_j.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 10^4). Description of the test cases follows.
The first line of each test case contains two integers n and m (1 β€ n, m β€ 10^6).
The second line of each test case contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ 10^9).
The third line of each test case contains m integers b_1, b_2, β¦, b_m (1 β€ b_i β€ 10^9).
It is guaranteed that the sum of n for all tests cases in one input doesn't exceed 10^6. The sum of m for all tests cases doesn't exceed 10^6 as well.
Output
For each test case, print one integer β the minimum possible number of inversions in the resulting array c.
Example
Input
3
3 4
1 2 3
4 3 2 1
3 3
3 2 1
1 2 3
5 4
1 3 5 3 1
4 3 6 1
Output
0
4
6
Note
Below is given the solution to get the optimal answer for each of the example test cases (elements of a are underscored).
* In the first test case, c = [\underline{1}, 1, \underline{2}, 2, \underline{3}, 3, 4].
* In the second test case, c = [1, 2, \underline{3}, \underline{2}, \underline{1}, 3].
* In the third test case, c = [\underline{1}, 1, 3, \underline{3}, \underline{5}, \underline{3}, \underline{1}, 4, 6]. "
"A group of n alpinists has just reached the foot of the mountain. The initial difficulty of climbing this mountain can be described as an integer d.
Each alpinist can be described by two integers s and a, where s is his skill of climbing mountains and a is his neatness.
An alpinist of skill level s is able to climb a mountain of difficulty p only if p β€ s. As an alpinist climbs a mountain, they affect the path and thus may change mountain difficulty. Specifically, if an alpinist of neatness a climbs a mountain of difficulty p the difficulty of this mountain becomes max(p, a).
Alpinists will climb the mountain one by one. And before the start, they wonder, what is the maximum number of alpinists who will be able to climb the mountain if they choose the right order. As you are the only person in the group who does programming, you are to answer the question.
Note that after the order is chosen, each alpinist who can climb the mountain, must climb the mountain at that time.
Input
The first line contains two integers n and d (1 β€ n β€ 500 000; 0 β€ d β€ 10^9) β the number of alpinists and the initial difficulty of the mountain.
Each of the next n lines contains two integers s_i and a_i (0 β€ s_i, a_i β€ 10^9) that define the skill of climbing and the neatness of the i-th alpinist.
Output
Print one integer equal to the maximum number of alpinists who can climb the mountain if they choose the right order to do so.
Examples
Input
3 2
2 6
3 5
5 7
Output
2
Input
3 3
2 4
6 4
4 6
Output
2
Input
5 0
1 5
4 8
2 7
7 6
3 2
Output
3
Note
In the first example, alpinists 2 and 3 can climb the mountain if they go in this order. There is no other way to achieve the answer of 2.
In the second example, alpinist 1 is not able to climb because of the initial difficulty of the mountain, while alpinists 2 and 3 can go up in any order.
In the third example, the mountain can be climbed by alpinists 5, 3 and 4 in this particular order. There is no other way to achieve optimal answer."
"Students of one unknown college don't have PE courses. That's why q of them decided to visit a gym nearby by themselves. The gym is open for n days and has a ticket system. At the i-th day, the cost of one ticket is equal to a_i. You are free to buy more than one ticket per day.
You can activate a ticket purchased at day i either at day i or any day later. Each activated ticket is valid only for k days. In other words, if you activate ticket at day t, it will be valid only at days t, t + 1, ..., t + k - 1.
You know that the j-th student wants to visit the gym at each day from l_j to r_j inclusive. Each student will use the following strategy of visiting the gym at any day i (l_j β€ i β€ r_j):
1. person comes to a desk selling tickets placed near the entrance and buy several tickets with cost a_i apiece (possibly, zero tickets);
2. if the person has at least one activated and still valid ticket, they just go in. Otherwise, they activate one of tickets purchased today or earlier and go in.
Note that each student will visit gym only starting l_j, so each student has to buy at least one ticket at day l_j.
Help students to calculate the minimum amount of money they have to spend in order to go to the gym.
Input
The first line contains three integers n, q and k (1 β€ n, q β€ 300 000; 1 β€ k β€ n) β the number of days, the number of students and the number of days each ticket is still valid.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the cost of one ticket at the corresponding day.
Each of the next q lines contains two integers l_i and r_i (1 β€ l_i β€ r_i β€ n) β the segment of days the corresponding student want to visit the gym.
Output
For each student, print the minimum possible amount of money they have to spend in order to go to the gym at desired days.
Example
Input
7 5 2
2 15 6 3 7 5 6
1 2
3 7
5 5
7 7
3 5
Output
2
12
7
6
9
Note
Let's see how each student have to spend their money:
* The first student should buy one ticket at day 1.
* The second student should buy one ticket at day 3 and two tickets at day 4. Note that student can keep purchased tickets for the next days.
* The third student should buy one ticket at day 5.
* The fourth student should buy one ticket at day 7.
* The fifth student should buy one ticket at day 3 and one at day 4. "
"Integers from 1 to n (inclusive) were sorted lexicographically (considering integers as strings). As a result, array a_1, a_2, ..., a_n was obtained.
Calculate value of (β_{i = 1}^n ((i - a_i) mod 998244353)) mod 10^9 + 7.
x mod y here means the remainder after division x by y. This remainder is always non-negative and doesn't exceed y - 1. For example, 5 mod 3 = 2, (-1) mod 6 = 5.
Input
The first line contains the single integer n (1 β€ n β€ 10^{12}).
Output
Print one integer β the required sum.
Examples
Input
3
Output
0
Input
12
Output
994733045
Input
21
Output
978932159
Input
1000000000000
Output
289817887
Note
A string a is lexicographically smaller than a string b if and only if one of the following holds:
* a is a prefix of b, but a β b;
* in the first position where a and b differ, the string a has a letter that appears earlier in the alphabet than the corresponding letter in b.
For example, 42 is lexicographically smaller than 6, because they differ in the first digit, and 4 < 6; 42 < 420, because 42 is a prefix of 420.
Let's denote 998244353 as M.
In the first example, array a is equal to [1, 2, 3].
* (1 - 1) mod M = 0 mod M = 0
* (2 - 2) mod M = 0 mod M = 0
* (3 - 3) mod M = 0 mod M = 0
As a result, (0 + 0 + 0) mod 10^9 + 7 = 0
In the second example, array a is equal to [1, 10, 11, 12, 2, 3, 4, 5, 6, 7, 8, 9].
* (1 - 1) mod M = 0 mod M = 0
* (2 - 10) mod M = (-8) mod M = 998244345
* (3 - 11) mod M = (-8) mod M = 998244345
* (4 - 12) mod M = (-8) mod M = 998244345
* (5 - 2) mod M = 3 mod M = 3
* (6 - 3) mod M = 3 mod M = 3
* (7 - 4) mod M = 3 mod M = 3
* (8 - 5) mod M = 3 mod M = 3
* (9 - 6) mod M = 3 mod M = 3
* (10 - 7) mod M = 3 mod M = 3
* (11 - 8) mod M = 3 mod M = 3
* (12 - 9) mod M = 3 mod M = 3
As a result, (0 + 998244345 + 998244345 + 998244345 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3) mod 10^9 + 7 = 2994733059 mod 10^9 + 7 = 994733045"
"For two positive integers l and r (l β€ r) let c(l, r) denote the number of integer pairs (i, j) such that l β€ i β€ j β€ r and \operatorname{gcd}(i, j) β₯ l. Here, \operatorname{gcd}(i, j) is the [greatest common divisor (GCD)](https://en.wikipedia.org/wiki/Greatest_common_divisor) of integers i and j.
YouKn0wWho has two integers n and k where 1 β€ k β€ n. Let f(n, k) denote the minimum of β_{i=1}^{k}{c(x_i+1,x_{i+1})} over all integer sequences 0=x_1 < x_2 < β¦ < x_{k} < x_{k+1}=n.
Help YouKn0wWho find f(n, k).
Input
The first line contains a single integer t (1 β€ t β€ 3 β
10^5) β the number of test cases.
The first and only line of each test case contains two integers n and k (1 β€ k β€ n β€ 10^5).
Output
For each test case, print a single integer β f(n, k).
Example
Input
4
6 2
4 4
3 1
10 3
Output
8
4
6
11
Note
In the first test case, YouKn0wWho can select the sequence [0, 2, 6]. So f(6, 2) = c(1, 2) + c(3, 6) = 3 + 5 = 8 which is the minimum possible."
"A sequence of integers b_1, b_2, β¦, b_m is called good if max(b_1, b_2, β¦, b_m) β
min(b_1, b_2, β¦, b_m) β₯ b_1 + b_2 + β¦ + b_m.
A sequence of integers a_1, a_2, β¦, a_n is called perfect if every non-empty subsequence of a is good.
YouKn0wWho has two integers n and M, M is prime. Help him find the number, modulo M, of perfect sequences a_1, a_2, β¦, a_n such that 1 β€ a_i β€ n + 1 for each integer i from 1 to n.
A sequence d is a subsequence of a sequence c if d can be obtained from c by deletion of several (possibly, zero or all) elements.
Input
The first and only line of the input contains two space-separated integers n and M (1 β€ n β€ 200; 10^8 β€ M β€ 10^9). It is guaranteed that M is prime.
Output
Print a single integer β the number of perfect sequences modulo M.
Examples
Input
2 998244353
Output
4
Input
4 100000007
Output
32
Input
69 999999937
Output
456886663
Note
In the first test case, the perfect sequences are [2, 2], [2, 3], [3, 2] and [3, 3].
In the second test case, some of the perfect sequences are [3, 4, 3, 5], [4, 5, 4, 4], [4, 5, 5, 5] etc. One example of a sequence which is not perfect is [2, 3, 3, 4], because, for example, the subsequence [2, 3, 4] is not an good as 2 β
4 < 2 + 3 + 4."
"It was October 18, 2017. Shohag, a melancholic soul, made a strong determination that he will pursue Competitive Programming seriously, by heart, because he found it fascinating. Fast forward to 4 years, he is happy that he took this road. He is now creating a contest on Codeforces. He found an astounding problem but has no idea how to solve this. Help him to solve the final problem of the round.
You are given three integers n, k and x. Find the number, modulo 998 244 353, of integer sequences a_1, a_2, β¦, a_n such that the following conditions are satisfied:
* 0 β€ a_i < 2^k for each integer i from 1 to n.
* There is no non-empty subsequence in a such that the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of the elements of the subsequence is x.
A sequence b is a subsequence of a sequence c if b can be obtained from c by deletion of several (possibly, zero or all) elements.
Input
The first line contains a single integer t (1 β€ t β€ 10^5) β the number of test cases.
The first and only line of each test case contains three space-separated integers n, k, and x (1 β€ n β€ 10^9, 0 β€ k β€ 10^7, 0 β€ x < 2^{\operatorname{min}(20, k)}).
It is guaranteed that the sum of k over all test cases does not exceed 5 β
10^7.
Output
For each test case, print a single integer β the answer to the problem.
Example
Input
6
2 2 0
2 1 1
3 2 3
69 69 69
2017 10 18
5 7 0
Output
6
1
15
699496932
892852568
713939942
Note
In the first test case, the valid sequences are [1, 2], [1, 3], [2, 1], [2, 3], [3, 1] and [3, 2].
In the second test case, the only valid sequence is [0, 0]."
"Shohag has an integer sequence a_1, a_2, β¦, a_n. He can perform the following operation any number of times (possibly, zero):
* Select any positive integer k (it can be different in different operations).
* Choose any position in the sequence (possibly the beginning or end of the sequence, or in between any two elements) and insert k into the sequence at this position.
* This way, the sequence a changes, and the next operation is performed on this changed sequence.
For example, if a=[3,3,4] and he selects k = 2, then after the operation he can obtain one of the sequences [\underline{2},3,3,4], [3,\underline{2},3,4], [3,3,\underline{2},4], or [3,3,4,\underline{2}].
Shohag wants this sequence to satisfy the following condition: for each 1 β€ i β€ |a|, a_i β€ i. Here, |a| denotes the size of a.
Help him to find the minimum number of operations that he has to perform to achieve this goal. We can show that under the constraints of the problem it's always possible to achieve this goal in a finite number of operations.
Input
The first line contains a single integer t (1 β€ t β€ 200) β the number of test cases.
The first line of each test case contains a single integer n (1 β€ n β€ 100) β the initial length of the sequence.
The second line of each test case contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ 10^9) β the elements of the sequence.
Output
For each test case, print a single integer β the minimum number of operations needed to perform to achieve the goal mentioned in the statement.
Example
Input
4
3
1 3 4
5
1 2 5 7 4
1
1
3
69 6969 696969
Output
1
3
0
696966
Note
In the first test case, we have to perform at least one operation, as a_2=3>2. We can perform the operation [1, 3, 4] β [1, \underline{2}, 3, 4] (the newly inserted element is underlined), now the condition is satisfied.
In the second test case, Shohag can perform the following operations:
[1, 2, 5, 7, 4] β [1, 2, \underline{3}, 5, 7, 4] β [1, 2, 3, \underline{4}, 5, 7, 4] β [1, 2, 3, 4, 5, \underline{3}, 7, 4].
In the third test case, the sequence already satisfies the condition."
"YouKn0wWho has an integer sequence a_1, a_2, β¦ a_n. Now he will split the sequence a into one or more consecutive subarrays so that each element of a belongs to exactly one subarray. Let k be the number of resulting subarrays, and h_1, h_2, β¦, h_k be the lengths of the longest increasing subsequences of corresponding subarrays.
For example, if we split [2, 5, 3, 1, 4, 3, 2, 2, 5, 1] into [2, 5, 3, 1, 4], [3, 2, 2, 5], [1], then h = [3, 2, 1].
YouKn0wWho wonders if it is possible to split the sequence a in such a way that the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of h_1, h_2, β¦, h_k is equal to 0. You have to tell whether it is possible.
The longest increasing subsequence (LIS) of a sequence b_1, b_2, β¦, b_m is the longest sequence of valid indices i_1, i_2, β¦, i_k such that i_1 < i_2 < β¦ < i_k and b_{i_1} < b_{i_2} < β¦ < b_{i_k}. For example, the LIS of [2, 5, 3, 3, 5] is [2, 3, 5], which has length 3.
An array c is a subarray of an array b if c can be obtained from b by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.
Input
The first line contains a single integer t (1 β€ t β€ 10 000) β the number of test cases.
The first line of each test case contains a single integer n (2 β€ n β€ 10^5).
The second line of each test case contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ 10^9).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 β
10^5.
Output
For each test case, print ""YES"" (without quotes) if it is possible to split into subarrays in the desired way, print ""NO"" (without quotes) otherwise. You can print each letter in any register (upper or lower).
Example
Input
4
7
1 3 4 2 2 1 5
3
1 3 4
5
1 3 2 4 2
4
4 3 2 1
Output
YES
NO
YES
YES
Note
In the first test case, YouKn0wWho can split the sequence in the following way: [1, 3, 4], [2, 2], [1, 5]. This way, the LIS lengths are h = [3, 1, 2], and the bitwise XOR of the LIS lengths is 3 β 1 β 2 = 0.
In the second test case, it can be shown that it is impossible to split the sequence into subarrays that will satisfy the condition."
"YouKn0wWho has an integer sequence a_1, a_2, β¦, a_n. He will perform the following operation until the sequence becomes empty: select an index i such that 1 β€ i β€ |a| and a_i is not divisible by (i + 1), and erase this element from the sequence. Here |a| is the length of sequence a at the moment of operation. Note that the sequence a changes and the next operation is performed on this changed sequence.
For example, if a=[3,5,4,5], then he can select i = 2, because a_2 = 5 is not divisible by i+1 = 3. After this operation the sequence is [3,4,5].
Help YouKn0wWho determine if it is possible to erase the whole sequence using the aforementioned operation.
Input
The first line contains a single integer t (1 β€ t β€ 10 000) β the number of test cases.
The first line of each test case contains a single integer n (1 β€ n β€ 10^5).
The second line of each test case contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ 10^9).
It is guaranteed that the sum of n over all test cases doesn't exceed 3 β
10^5.
Output
For each test case, print ""YES"" (without quotes) if it is possible to erase the whole sequence using the aforementioned operation, print ""NO"" (without quotes) otherwise. You can print each letter in any register (upper or lower).
Example
Input
5
3
1 2 3
1
2
2
7 7
10
384836991 191890310 576823355 782177068 404011431 818008580 954291757 160449218 155374934 840594328
8
6 69 696 69696 696969 6969696 69696969 696969696
Output
YES
NO
YES
YES
NO
Note
In the first test case, YouKn0wWho can perform the following operations (the erased elements are underlined): [1, \underline{2}, 3] β [\underline{1}, 3] β [\underline{3}] β [ ].
In the second test case, it is impossible to erase the sequence as i can only be 1, and when i=1, a_1 = 2 is divisible by i + 1 = 2."
"YouKn0wWho has two even integers x and y. Help him to find an integer n such that 1 β€ n β€ 2 β
10^{18} and n mod x = y mod n. Here, a mod b denotes the remainder of a after division by b. If there are multiple such integers, output any. It can be shown that such an integer always exists under the given constraints.
Input
The first line contains a single integer t (1 β€ t β€ 10^5) β the number of test cases.
The first and only line of each test case contains two integers x and y (2 β€ x, y β€ 10^9, both are even).
Output
For each test case, print a single integer n (1 β€ n β€ 2 β
10^{18}) that satisfies the condition mentioned in the statement. If there are multiple such integers, output any. It can be shown that such an integer always exists under the given constraints.
Example
Input
4
4 8
4 2
420 420
69420 42068
Output
4
10
420
9969128
Note
In the first test case, 4 mod 4 = 8 mod 4 = 0.
In the second test case, 10 mod 4 = 2 mod 10 = 2.
In the third test case, 420 mod 420 = 420 mod 420 = 0."
"For an array b of n integers, the extreme value of this array is the minimum number of times (possibly, zero) the following operation has to be performed to make b non-decreasing:
* Select an index i such that 1 β€ i β€ |b|, where |b| is the current length of b.
* Replace b_i with two elements x and y such that x and y both are positive integers and x + y = b_i.
* This way, the array b changes and the next operation is performed on this modified array.
For example, if b = [2, 4, 3] and index 2 gets selected, then the possible arrays after this operation are [2, \underline{1}, \underline{3}, 3], [2, \underline{2}, \underline{2}, 3], or [2, \underline{3}, \underline{1}, 3]. And consequently, for this array, this single operation is enough to make it non-decreasing: [2, 4, 3] β [2, \underline{2}, \underline{2}, 3].
It's easy to see that every array of positive integers can be made non-decreasing this way.
YouKn0wWho has an array a of n integers. Help him find the sum of extreme values of all nonempty subarrays of a modulo 998 244 353. If a subarray appears in a multiple times, its extreme value should be counted the number of times it appears.
An array d is a subarray of an array c if d can be obtained from c by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.
Input
The first line contains a single integer t (1 β€ t β€ 10 000) β the number of test cases.
The first line of each test case contains a single integer n (1 β€ n β€ 10^5).
The second line of each test case contains n integers a_1, a_2, β¦, a_n (1 β€ a_i β€ 10^5).
It is guaranteed that the sum of n over all test cases doesn't exceed 10^5.
Output
For each test case, print a single integer β the sum of extreme values of all subarrays of a modulo 998 244 353.
Example
Input
4
3
5 4 3
4
3 2 1 4
1
69
8
7264 40515 28226 92776 35285 21709 75124 48163
Output
5
9
0
117
Note
Let f(l, r) denote the extreme value of [a_l, a_{l+1}, β¦, a_r].
In the first test case,
* f(1, 3) = 3, because YouKn0wWho can perform the following operations on the subarray [5, 4, 3] (the newly inserted elements are underlined):
[5, 4, 3] β [\underline{3}, \underline{2}, 4, 3] β [3, 2, \underline{2}, \underline{2}, 3] β [\underline{1}, \underline{2}, 2, 2, 2, 3];
* f(1, 2) = 1, because [5, 4] β [\underline{2}, \underline{3}, 4];
* f(2, 3) = 1, because [4, 3] β [\underline{1}, \underline{3}, 3];
* f(1, 1) = f(2, 2) = f(3, 3) = 0, because they are already non-decreasing.
So the total sum of extreme values of all subarrays of a = 3 + 1 + 1 + 0 + 0 + 0 = 5."
"You are given a string s of length n consisting of characters a and/or b.
Let \operatorname{AB}(s) be the number of occurrences of string ab in s as a substring. Analogically, \operatorname{BA}(s) is the number of occurrences of ba in s as a substring.
In one step, you can choose any index i and replace s_i with character a or b.
What is the minimum number of steps you need to make to achieve \operatorname{AB}(s) = \operatorname{BA}(s)?
Reminder:
The number of occurrences of string d in s as substring is the number of indices i (1 β€ i β€ |s| - |d| + 1) such that substring s_i s_{i + 1} ... s_{i + |d| - 1} is equal to d. For example, \operatorname{AB}(aabbbabaa) = 2 since there are two indices i: i = 2 where aabbbabaa and i = 6 where aabbbabaa.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 1000). Description of the test cases follows.
The first and only line of each test case contains a single string s (1 β€ |s| β€ 100, where |s| is the length of the string s), consisting only of characters a and/or b.
Output
For each test case, print the resulting string s with \operatorname{AB}(s) = \operatorname{BA}(s) you'll get making the minimum number of steps.
If there are multiple answers, print any of them.
Example
Input
4
b
aabbbabaa
abbb
abbaab
Output
b
aabbbabaa
bbbb
abbaaa
Note
In the first test case, both \operatorname{AB}(s) = 0 and \operatorname{BA}(s) = 0 (there are no occurrences of ab (ba) in b), so can leave s untouched.
In the second test case, \operatorname{AB}(s) = 2 and \operatorname{BA}(s) = 2, so you can leave s untouched.
In the third test case, \operatorname{AB}(s) = 1 and \operatorname{BA}(s) = 0. For example, we can change s_1 to b and make both values zero.
In the fourth test case, \operatorname{AB}(s) = 2 and \operatorname{BA}(s) = 1. For example, we can change s_6 to a and make both values equal to 1."
"Berland State University has received a new update for the operating system. Initially it is installed only on the 1-st computer.
Update files should be copied to all n computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy them using a patch cable (a cable connecting two computers directly). Only one patch cable can be connected to a computer at a time. Thus, from any computer where the update files are installed, they can be copied to some other computer in exactly one hour.
Your task is to find the minimum number of hours required to copy the update files to all n computers if there are only k patch cables in Berland State University.
Input
The first line contains a single integer t (1 β€ t β€ 10^5) β the number of test cases.
Each test case consists of a single line that contains two integers n and k (1 β€ k β€ n β€ 10^{18}) β the number of computers and the number of patch cables.
Output
For each test case print one integer β the minimum number of hours required to copy the update files to all n computers.
Example
Input
4
8 3
6 6
7 1
1 1
Output
4
3
6
0
Note
Let's consider the test cases of the example:
* n=8, k=3:
1. during the first hour, we copy the update files from the computer 1 to the computer 2;
2. during the second hour, we copy the update files from the computer 1 to the computer 3, and from the computer 2 to the computer 4;
3. during the third hour, we copy the update files from the computer 1 to the computer 5, from the computer 2 to the computer 6, and from the computer 3 to the computer 7;
4. during the fourth hour, we copy the update files from the computer 2 to the computer 8.
* n=6, k=6:
1. during the first hour, we copy the update files from the computer 1 to the computer 2;
2. during the second hour, we copy the update files from the computer 1 to the computer 3, and from the computer 2 to the computer 4;
3. during the third hour, we copy the update files from the computer 1 to the computer 5, and from the computer 2 to the computer 6.
* n=7, k=1:
1. during the first hour, we copy the update files from the computer 1 to the computer 2;
2. during the second hour, we copy the update files from the computer 1 to the computer 3;
3. during the third hour, we copy the update files from the computer 1 to the computer 4;
4. during the fourth hour, we copy the update files from the computer 4 to the computer 5;
5. during the fifth hour, we copy the update files from the computer 4 to the computer 6;
6. during the sixth hour, we copy the update files from the computer 3 to the computer 7. "
"In Berland, n different types of banknotes are used. Banknotes of the i-th type have denomination 10^{a_i} burles (burles are the currency used in Berland); the denomination of banknotes of the first type is exactly 1.
Let's denote f(s) as the minimum number of banknotes required to represent exactly s burles. For example, if the denominations of banknotes used in Berland are 1, 10 and 100, then f(59) = 14: 9 banknotes with denomination of 1 burle and 5 banknotes with denomination of 10 burles can be used to represent exactly 9 β
1 + 5 β
10 = 59 burles, and there's no way to do it with fewer banknotes.
For a given integer k, find the minimum positive number of burles s that cannot be represented with k or fewer banknotes (that is, f(s) > k).
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β number of test cases.
The first line of each test case contains two integers n and k (1 β€ n β€ 10; 1 β€ k β€ 10^9).
The next line contains n integers a_1, a_2, ..., a_n (0 = a_1 < a_2 < ... < a_n β€ 9).
Output
For each test case, print one integer β the minimum positive number of burles s that cannot be represented with k or fewer banknotes.
Example
Input
4
3 13
0 1 2
2 777
0 4
3 255
0 1 3
10 1000000000
0 1 2 3 4 5 6 7 8 9
Output
59
778
148999
999999920999999999"
"You are given a matrix, consisting of n rows and m columns. The j-th cell of the i-th row contains an integer a_{ij}.
First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue.
Then, you have to choose an integer k (1 β€ k < m) and cut the colored matrix in such a way that the first k columns become a separate matrix (the left matrix) and the last m-k columns become a separate matrix (the right matrix).
The coloring and the cut are called perfect if two properties hold:
* every red cell in the left matrix contains an integer greater than every blue cell in the left matrix;
* every blue cell in the right matrix contains an integer greater than every red cell in the right matrix.
Find any perfect coloring and cut, or report that there are none.
Input
The first line contains a single integer t (1 β€ t β€ 1000) β the number of testcases.
Then the descriptions of t testcases follow.
The first line of each testcase contains two integers n and m (2 β€ n, m β€ 5 β
10^5; n β
m β€ 10^6) β the number of rows and the number of columns in the matrix, respectively.
The i-th of the next n lines contains m integers a_{i1}, a_{i2}, ..., a_{im} (1 β€ a_{ij} β€ 10^6).
The sum of n β
m over all testcases doesn't exceed 10^6.
Output
For each testcase print an answer. If there are no perfect colorings and cuts in the matrix, then print ""NO"".
Otherwise, first, print ""YES"". Then a string, consisting of n characters: the i-th character should be 'R' if the i-th row is colored red and 'B' if it's colored blue. The string should contain at least one 'R' and at least one 'B'. Finally, print an integer k (1 β€ k < m) β the number of columns from the left that are cut.
Example
Input
3
5 5
1 5 8 8 7
5 2 1 4 3
1 6 9 7 5
9 3 3 3 2
1 7 9 9 8
3 3
8 9 8
1 5 3
7 5 7
2 6
3 3 3 2 2 2
1 1 1 4 4 4
Output
YES
BRBRB 1
NO
YES
RB 3
Note
The coloring and the cut for the first testcase:
<image>"
"There are n heroes fighting in the arena. Initially, the i-th hero has a_i health points.
The fight in the arena takes place in several rounds. At the beginning of each round, each alive hero deals 1 damage to all other heroes. Hits of all heroes occur simultaneously. Heroes whose health is less than 1 at the end of the round are considered killed.
If exactly 1 hero remains alive after a certain round, then he is declared the winner. Otherwise, there is no winner.
Your task is to calculate the number of ways to choose the initial health points for each hero a_i, where 1 β€ a_i β€ x, so that there is no winner of the fight. The number of ways can be very large, so print it modulo 998244353. Two ways are considered different if at least one hero has a different amount of health. For example, [1, 2, 1] and [2, 1, 1] are different.
Input
The only line contains two integers n and x (2 β€ n β€ 500; 1 β€ x β€ 500).
Output
Print one integer β the number of ways to choose the initial health points for each hero a_i, where 1 β€ a_i β€ x, so that there is no winner of the fight, taken modulo 998244353.
Examples
Input
2 5
Output
5
Input
3 3
Output
15
Input
5 4
Output
1024
Input
13 37
Output
976890680"
"You are given a tree consisting of n vertices. Recall that a tree is an undirected connected acyclic graph. The given tree is rooted at the vertex 1.
You have to process q queries. In each query, you are given a vertex of the tree v and an integer k.
To process a query, you may delete any vertices from the tree in any order, except for the root and the vertex v. When a vertex is deleted, its children become the children of its parent. You have to process a query in such a way that maximizes the value of c(v) - m β
k (where c(v) is the resulting number of children of the vertex v, and m is the number of vertices you have deleted). Print the maximum possible value you can obtain.
The queries are independent: the changes you make to the tree while processing a query don't affect the tree in other queries.
Input
The first line contains one integer n (1 β€ n β€ 2 β
10^5) β the number of vertices in the tree.
Then n-1 lines follow, the i-th of them contains two integers x_i and y_i (1 β€ x_i, y_i β€ n; x_i β y_i) β the endpoints of the i-th edge. These edges form a tree.
The next line contains one integer q (1 β€ q β€ 2 β
10^5) β the number of queries.
Then q lines follow, the j-th of them contains two integers v_j and k_j (1 β€ v_j β€ n; 0 β€ k_j β€ 2 β
10^5) β the parameters of the j-th query.
Output
For each query, print one integer β the maximum value of c(v) - m β
k you can achieve.
Example
Input
8
6 7
3 2
8 3
5 7
7 4
7 1
7 3
6
1 0
1 2
1 3
7 1
5 0
7 200000
Output
5
2
1
4
0
4
Note
The tree in the first example is shown in the following picture:
<image>
Answers to the queries are obtained as follows:
1. v=1,k=0: you can delete vertices 7 and 3, so the vertex 1 has 5 children (vertices 2, 4, 5, 6, and 8), and the score is 5 - 2 β
0 = 5;
2. v=1,k=2: you can delete the vertex 7, so the vertex 1 has 4 children (vertices 3, 4, 5, and 6), and the score is 4 - 1 β
2 = 2.
3. v=1,k=3: you shouldn't delete any vertices, so the vertex 1 has only one child (vertex 7), and the score is 1 - 0 β
3 = 1;
4. v=7,k=1: you can delete the vertex 3, so the vertex 7 has 5 children (vertices 2, 4, 5, 6, and 8), and the score is 5 - 1 β
1 = 4;
5. v=5,k=0: no matter what you do, the vertex 5 will have no children, so the score is 0;
6. v=7,k=200000: you shouldn't delete any vertices, so the vertex 7 has 4 children (vertices 3, 4, 5, and 6), and the score is 4 - 0 β
200000 = 4. "
"You are given a keyboard that consists of 26 keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.
You have to type the word s on this keyboard. It also consists only of lowercase Latin letters.
To type a word, you need to type all its letters consecutively one by one. To type each letter you must position your hand exactly over the corresponding key and press it.
Moving the hand between the keys takes time which is equal to the absolute value of the difference between positions of these keys (the keys are numbered from left to right). No time is spent on pressing the keys and on placing your hand over the first letter of the word.
For example, consider a keyboard where the letters from 'a' to 'z' are arranged in consecutive alphabetical order. The letters 'h', 'e', 'l' and 'o' then are on the positions 8, 5, 12 and 15, respectively. Therefore, it will take |5 - 8| + |12 - 5| + |12 - 12| + |15 - 12| = 13 units of time to type the word ""hello"".
Determine how long it will take to print the word s.
Input
The first line contains an integer t (1 β€ t β€ 1000) β the number of test cases.
The next 2t lines contain descriptions of the test cases.
The first line of a description contains a keyboard β a string of length 26, which consists only of lowercase Latin letters. Each of the letters from 'a' to 'z' appears exactly once on the keyboard.
The second line of the description contains the word s. The word has a length from 1 to 50 letters inclusive and consists of lowercase Latin letters.
Output
Print t lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word s on the given keyboard.
Example
Input
5
abcdefghijklmnopqrstuvwxyz
hello
abcdefghijklmnopqrstuvwxyz
i
abcdefghijklmnopqrstuvwxyz
codeforces
qwertyuiopasdfghjklzxcvbnm
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
qwertyuiopasdfghjklzxcvbnm
abacaba
Output
13
0
68
0
74"
"The grasshopper is located on the numeric axis at the point with coordinate x_0.
Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate x with a distance d to the left moves the grasshopper to a point with a coordinate x - d, while jumping to the right moves him to a point with a coordinate x + d.
The grasshopper is very fond of positive integers, so for each integer i starting with 1 the following holds: exactly i minutes after the start he makes a jump with a distance of exactly i. So, in the first minutes he jumps by 1, then by 2, and so on.
The direction of a jump is determined as follows: if the point where the grasshopper was before the jump has an even coordinate, the grasshopper jumps to the left, otherwise he jumps to the right.
For example, if after 18 consecutive jumps he arrives at the point with a coordinate 7, he will jump by a distance of 19 to the right, since 7 is an odd number, and will end up at a point 7 + 19 = 26. Since 26 is an even number, the next jump the grasshopper will make to the left by a distance of 20, and it will move him to the point 26 - 20 = 6.
Find exactly which point the grasshopper will be at after exactly n jumps.
Input
The first line of input contains an integer t (1 β€ t β€ 10^4) β the number of test cases.
Each of the following t lines contains two integers x_0 (-10^{14} β€ x_0 β€ 10^{14}) and n (0 β€ n β€ 10^{14}) β the coordinate of the grasshopper's initial position and the number of jumps.
Output
Print exactly t lines. On the i-th line print one integer β the answer to the i-th test case β the coordinate of the point the grasshopper will be at after making n jumps from the point x_0.
Example
Input
9
0 1
0 2
10 10
10 99
177 13
10000000000 987654321
-433494437 87178291199
1 0
-1 1
Output
-1
1
11
110
190
9012345679
-87611785637
1
0
Note
The first two test cases in the example correspond to the first two jumps from the point x_0 = 0.
Since 0 is an even number, the first jump of length 1 is made to the left, and the grasshopper ends up at the point 0 - 1 = -1.
Then, since -1 is an odd number, a jump of length 2 is made to the right, bringing the grasshopper to the point with coordinate -1 + 2 = 1."
"Yelisey has an array a of n integers.
If a has length strictly greater than 1, then Yelisei can apply an operation called minimum extraction to it:
1. First, Yelisei finds the minimal number m in the array. If there are several identical minima, Yelisey can choose any of them.
2. Then the selected minimal element is removed from the array. After that, m is subtracted from each remaining element.
Thus, after each operation, the length of the array is reduced by 1.
For example, if a = [1, 6, -4, -2, -4], then the minimum element in it is a_3 = -4, which means that after this operation the array will be equal to a=[1 {- (-4)}, 6 {- (-4)}, -2 {- (-4)}, -4 {- (-4)}] = [5, 10, 2, 0].
Since Yelisey likes big numbers, he wants the numbers in the array a to be as big as possible.
Formally speaking, he wants to make the minimum of the numbers in array a to be maximal possible (i.e. he want to maximize a minimum). To do this, Yelisey can apply the minimum extraction operation to the array as many times as he wants (possibly, zero). Note that the operation cannot be applied to an array of length 1.
Help him find what maximal value can the minimal element of the array have after applying several (possibly, zero) minimum extraction operations to the array.
Input
The first line contains an integer t (1 β€ t β€ 10^4) β the number of test cases.
The next 2t lines contain descriptions of the test cases.
In the description of each test case, the first line contains an integer n (1 β€ n β€ 2 β
10^5) β the original length of the array a. The second line of the description lists n space-separated integers a_i (-10^9 β€ a_i β€ 10^9) β elements of the array a.
It is guaranteed that the sum of n over all test cases does not exceed 2 β
10^5.
Output
Print t lines, each of them containing the answer to the corresponding test case. The answer to the test case is a single integer β the maximal possible minimum in a, which can be obtained by several applications of the described operation to it.
Example
Input
8
1
10
2
0 0
3
-1 2 0
4
2 10 1 7
2
2 3
5
3 2 -4 -2 0
2
-1 1
1
-2
Output
10
0
2
5
2
2
2
-2
Note
In the first example test case, the original length of the array n = 1. Therefore minimum extraction cannot be applied to it. Thus, the array remains unchanged and the answer is a_1 = 10.
In the second set of input data, the array will always consist only of zeros.
In the third set, the array will be changing as follows: [\color{blue}{-1}, 2, 0] β [3, \color{blue}{1}] β [\color{blue}{2}]. The minimum elements are highlighted with \color{blue}{blue}. The maximal one is 2.
In the fourth set, the array will be modified as [2, 10, \color{blue}{1}, 7] β [\color{blue}{1}, 9, 6] β [8, \color{blue}{5}] β [\color{blue}{3}]. Similarly, the maximum of the minimum elements is 5."
"You are given an array of integers a of length n. The elements of the array can be either different or the same.
Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step:
* either you can select any blue element and decrease its value by 1;
* or you can select any red element and increase its value by 1.
Situations in which there are no elements of some color at all are also possible. For example, if the whole array is colored blue or red, one of the operations becomes unavailable.
Determine whether it is possible to make 0 or more steps such that the resulting array is a permutation of numbers from 1 to n?
In other words, check whether there exists a sequence of steps (possibly empty) such that after applying it, the array a contains in some order all numbers from 1 to n (inclusive), each exactly once.
Input
The first line contains an integer t (1 β€ t β€ 10^4) β the number of input data sets in the test.
The description of each set of input data consists of three lines. The first line contains an integer n (1 β€ n β€ 2 β
10^5) β the length of the original array a. The second line contains n integers a_1, a_2, ..., a_n (-10^9 β€ a_i β€ 10^9) β the array elements themselves.
The third line has length n and consists exclusively of the letters 'B' and/or 'R': ith character is 'B' if a_i is colored blue, and is 'R' if colored red.
It is guaranteed that the sum of n over all input sets does not exceed 2 β
10^5.
Output
Print t lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise.
You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a positive answer).
Example
Input
8
4
1 2 5 2
BRBR
2
1 1
BB
5
3 1 4 2 5
RBRRB
5
3 1 3 1 3
RBRRB
5
5 1 5 1 5
RBRRB
4
2 2 2 2
BRBR
2
1 -2
BR
4
-2 -1 4 0
RRRR
Output
YES
NO
YES
YES
NO
YES
YES
YES
Note
In the first test case of the example, the following sequence of moves can be performed:
* choose i=3, element a_3=5 is blue, so we decrease it, we get a=[1,2,4,2];
* choose i=2, element a_2=2 is red, so we increase it, we get a=[1,3,4,2];
* choose i=3, element a_3=4 is blue, so we decrease it, we get a=[1,3,3,2];
* choose i=2, element a_2=2 is red, so we increase it, we get a=[1,4,3,2].
We got that a is a permutation. Hence the answer is YES."
"The robot is located on a checkered rectangular board of size n Γ m (n rows, m columns). The rows in the board are numbered from 1 to n from top to bottom, and the columns β from 1 to m from left to right.
The robot is able to move from the current cell to one of the four cells adjacent by side.
The sequence of commands s executed by the robot is given. Each command is denoted by one of the symbols 'L', 'R', 'D' or 'U', and triggers the movement to left, right, down or up, respectively.
The robot can start its movement in any cell. The robot executes the commands starting from the first one, strictly in the order in which they are listed in s. If the robot moves beyond the edge of the board, it falls and breaks. A command that causes the robot to break is not considered successfully executed.
The robot's task is to execute as many commands as possible without falling off the board. For example, on board 3 Γ 3, if the robot starts a sequence of actions s=""RRDLUU"" (""right"", ""right"", ""down"", ""left"", ""up"", ""up"") from the central cell, the robot will perform one command, then the next command will force him to cross the edge. If the robot starts moving from the cell (2, 1) (second row, first column) then all commands will be executed successfully and the robot will stop at the cell (1, 2) (first row, second column).
<image> The robot starts from cell (2, 1) (second row, first column). It moves right, right, down, left, up, and up. In this case it ends in the cell (1, 2) (first row, second column).
Determine the cell from which the robot should start its movement in order to execute as many commands as possible.
Input
The first line contains an integer t (1 β€ t β€ 10^4) β the number of test cases.
The next 2t lines contain descriptions of the test cases.
In the description of each test case, the first line contains two integers n and m (1 β€ n, m β€ 10^6) β the height and width of the field that the robot is located on. The second line of the description is a string s consisting solely of characters 'L', 'R', 'D' and 'U' β the sequence of commands the robot executes. The string has a length from 1 to 10^6 commands.
It is guaranteed that the total length of s over all test cases does not exceed 10^6.
Output
Print t lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers r (1 β€ r β€ n) and c (1 β€ c β€ m), separated by a space β the coordinates of the cell (row number and column number) from which the robot should start moving to perform as many commands as possible.
If there are several such cells, you may output any of them.
Example
Input
4
1 1
L
1 2
L
3 3
RRDLUU
4 3
LUURRDDLLLUU
Output
1 1
1 2
2 1
3 2"
"The robot is located on a checkered rectangular board of size n Γ m (n rows, m columns). The rows in the board are numbered from 1 to n from top to bottom, and the columns β from 1 to m from left to right.
The robot is able to move from the current cell to one of the four cells adjacent by side.
Each cell has one of the symbols 'L', 'R', 'D' or 'U' written on it, indicating the direction in which the robot will move when it gets in that cell β left, right, down or up, respectively.
The robot can start its movement in any cell. He then moves to the adjacent square in the direction indicated on the current square in one move.
* If the robot moves beyond the edge of the board, it falls and breaks.
* If the robot appears in the cell it already visited before, it breaks (it stops and doesn't move anymore).
Robot can choose any cell as the starting cell. Its goal is to make the maximum number of steps before it breaks or stops.
Determine from which square the robot should start its movement in order to execute as many commands as possible. A command is considered successfully completed if the robot has moved from the square on which that command was written (it does not matter whether to another square or beyond the edge of the board).
Input
The first line contains an integer t (1 β€ t β€ 10000) β the number of test cases in the test.
Each test case's description is preceded by a blank line. Next is a line that contains integers n and m (1 β€ n β€ 2000; 1 β€ m β€ 2000) β the height and width of the board. This line followed by n lines, the i-th of which describes the i-th line of the board. Each of them is exactly m letters long and consists of symbols 'L', 'R', 'D' and 'U'.
It is guaranteed that the sum of sizes of all boards in the input does not exceed 4β
10^6.
Output
For each test case, output three integers r, c and d (1 β€ r β€ n; 1 β€ c β€ m; d β₯ 0), which denote that the robot should start moving from cell (r, c) to make the maximum number of moves d. If there are several answers, output any of them.
Example
Input
7
1 1
R
1 3
RRL
2 2
DL
RU
2 2
UD
RU
3 2
DL
UL
RU
4 4
RRRD
RUUD
URUD
ULLR
4 4
DDLU
RDDU
UUUU
RDLD
Output
1 1 1
1 1 3
1 1 4
2 1 3
3 1 5
4 3 12
1 1 4"
"A known chef has prepared n dishes: the i-th dish consists of a_i grams of fish and b_i grams of meat.
The banquet organizers estimate the balance of n dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat.
Technically, the balance equals to \left|β_{i=1}^n a_i - β_{i=1}^n b_i\right|. The smaller the balance, the better.
In order to improve the balance, a taster was invited. He will eat exactly m grams of food from each dish. For each dish, the taster determines separately how much fish and how much meat he will eat. The only condition is that he should eat exactly m grams of each dish in total.
Determine how much of what type of food the taster should eat from each dish so that the value of the balance is as minimal as possible. If there are several correct answers, you may choose any of them.
Input
The first line of input data contains an integer t (1 β€ t β€ 10^4) β the number of the test cases.
Each test case's description is preceded by a blank line. Next comes a line that contains integers n and m (1 β€ n β€ 2 β
10^5; 0 β€ m β€ 10^6). The next n lines describe dishes, the i-th of them contains a pair of integers a_i and b_i (0 β€ a_i, b_i β€ 10^6) β the masses of fish and meat in the i-th dish.
It is guaranteed that it is possible to eat m grams of food from each dish. In other words, m β€ a_i+b_i for all i from 1 to n inclusive.
The sum of all n values over all test cases in the test does not exceed 2 β
10^5.
Output
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly m grams of food from each dish.
Then print n lines that describe a way to do this: the i-th line should contain two integers x_i and y_i (0 β€ x_i β€ a_i; 0 β€ y_i β€ b_i; x_i+y_i=m), where x_i is how many grams of fish taster should eat from the i-th meal and y_i is how many grams of meat.
If there are several ways to achieve a minimal balance, find any of them.
Example
Input
8
1 5
3 4
1 6
3 4
2 2
1 3
4 2
2 4
1 3
1 7
3 6
1 7
1 8
1 9
3 6
1 8
1 9
30 10
3 4
3 1
3 2
4 1
5 4
0 7
6 4
0 8
4 1
5 3
Output
0
2 3
1
3 3
0
1 1
1 1
2
1 3
0 4
3
0 6
0 6
0 6
7
1 5
1 5
6 0
0
3 1
3 1
3 1
0
0 4
2 2
0 4
3 1
1 3"
"The chef has cooked n dishes yet again: the i-th dish consists of a_i grams of fish and b_i grams of meat.
Banquet organizers consider two dishes i and j equal if a_i=a_j and b_i=b_j at the same time.
The banquet organizers estimate the variety of n dishes as follows. The variety of a set of dishes is equal to the number of different dishes in it. The less variety is, the better.
In order to reduce the variety, a taster was invited. He will eat exactly m_i grams of food from each dish. For each dish, the taster determines separately how much fish and how much meat he will eat. The only condition is that he will eat exactly m_i grams of the i-th dish in total.
Determine how much of what type of food the taster should eat from each dish so that the value of variety is the minimum possible. If there are several correct answers, you may output any of them.
Input
The first line of input data contains an integer t (1 β€ t β€ 10^4) β the number of test cases.
Each test case's description is preceded by a blank line. Next comes a line that contains an integer n (1 β€ n β€ 2 β
10^5) β the number of dishes. Then follows n lines, i-th of which contains three integers a_i, b_i and m_i (0 β€ a_i, b_i β€ 10^6; 0 β€ m_i β€ a_i+b_i) β the mass of fish in i-th dish, the mass of meat in i-th dish and how many grams in total the taster should eat in i-th dish.
The sum of all n values for all input data sets in the test does not exceed 2 β
10^5.
Output
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly m_i grams of food (for all i from 1 to n) from a dish i.
Then print n lines that describe a way to do this: the i-th line should contain two integers x_i and y_i (0 β€ x_i β€ a_i; 0 β€ y_i β€ b_i; x_i+y_i=m_i), where x_i is how many grams of fish the taster should eat from i-th dish, and y_i is how many grams of meat.
If there are several ways to achieve a minimum balance, print any of them.
Example
Input
5
3
10 10 2
9 9 0
10 9 1
2
3 4 1
5 1 2
3
7 2 5
6 5 4
5 5 6
1
13 42 50
5
5 7 12
3 1 4
7 3 7
0 0 0
4 1 5
Output
1
1 1
0 0
1 0
2
0 1
1 1
2
3 2
0 4
1 5
1
8 42
2
5 7
3 1
4 3
0 0
4 1"
"Given n, find any array a_1, a_2, β¦, a_n of integers such that all of the following conditions hold:
* 1 β€ a_i β€ 10^9 for every i from 1 to n.
* a_1 < a_2 < β¦ <a_n
* For every i from 2 to n, a_i isn't divisible by a_{i-1}
It can be shown that such an array always exists under the constraints of the problem.
Input
The first line contains the number of test cases t (1 β€ t β€ 100). Description of the test cases follows.
The only line of each test case contains a single integer n (1 β€ n β€ 1000).
It is guaranteed that the sum of n over all test cases does not exceed 10^4.
Output
For each test case print n integers a_1, a_2, β¦, a_n β the array you found. If there are multiple arrays satisfying all the conditions, print any of them.
Example
Input
3
1
2
7
Output
1
2 3
111 1111 11111 111111 1111111 11111111 111111111
Note
In the first test case, array [1] satisfies all the conditions.
In the second test case, array [2, 3] satisfies all the conditions, as 2<3 and 3 is not divisible by 2.
In the third test case, array [111, 1111, 11111, 111111, 1111111, 11111111, 111111111] satisfies all the conditions, as it's increasing and a_i isn't divisible by a_{i-1} for any i from 2 to 7."
"You are given three integers n, a, b. Determine if there exists a permutation p_1, p_2, β¦, p_n of integers from 1 to n, such that:
* There are exactly a integers i with 2 β€ i β€ n-1 such that p_{i-1} < p_i > p_{i+1} (in other words, there are exactly a local maximums).
* There are exactly b integers i with 2 β€ i β€ n-1 such that p_{i-1} > p_i < p_{i+1} (in other words, there are exactly b local minimums).
If such permutations exist, find any such permutation.
Input
The first line of the input contains a single integer t (1 β€ t β€ 10^4) β the number of test cases. The description of test cases follows.
The only line of each test case contains three integers n, a and b (2 β€ n β€ 10^5, 0 β€ a,b β€ n).
The sum of n over all test cases doesn't exceed 10^5.
Output
For each test case, if there is no permutation with the requested properties, output -1.
Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
Example
Input
3
4 1 1
6 1 2
6 4 0
Output
1 3 2 4
4 2 3 1 5 6
-1
Note
In the first test case, one example of such permutations is [1, 3, 2, 4]. In it p_1 < p_2 > p_3, and 2 is the only such index, and p_2> p_3 < p_4, and 3 the only such index.
One can show that there is no such permutation for the third test case."
"n players are playing a game.
There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map.
You are the game master and want to organize a tournament. There will be a total of n-1 battles. While there is more than one player in the tournament, choose any map and any two remaining players to fight on it. The player who loses will be eliminated from the tournament.
In the end, exactly one player will remain, and he is declared the winner of the tournament. For each player determine if he can win the tournament.
Input
The first line contains a single integer t (1 β€ t β€ 100) β the number of test cases. The description of test cases follows.
The first line of each test case contains a single integer n (1 β€ n β€ 10^5) β the number of players.
The second line of each test case contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9, a_i β a_j for i β j), where a_i is the strength of the i-th player on the first map.
The third line of each test case contains n integers b_1, b_2, ..., b_n (1 β€ b_i β€ 10^9, b_i β b_j for i β j), where b_i is the strength of the i-th player on the second map.
It is guaranteed that the sum of n over all test cases does not exceed 10^5.
Output
For each test case print a string of length n. i-th character should be ""1"" if the i-th player can win the tournament, or ""0"" otherwise.
Example
Input
3
4
1 2 3 4
1 2 3 4
4
11 12 20 21
44 22 11 30
1
1000000000
1000000000
Output
0001
1111
1
Note
In the first test case, the 4-th player will beat any other player on any game, so he will definitely win the tournament.
In the second test case, everyone can be a winner.
In the third test case, there is only one player. Clearly, he will win the tournament."
"You are given n dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.
The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each 1 β€ i β€ n the color of the right cell of the i-th domino is different from the color of the left cell of the ((i mod n)+1)-st domino.
Note that you can't rotate the dominoes, so the left cell always remains the left cell, and the right cell always remains the right cell.
Count the number of valid ways to color the yet uncolored cells of dominoes. Two ways are considered different if there is a cell that is colored white in one way and black in the other. In particular, colorings BW WB and WB BW different (and both invalid).
As this number can be very big, output it modulo 998 244 353.
Input
The first line of the input contains a single integer n (1 β€ n β€ 10^5) β the number of dominoes.
The next n lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the corresponding cell is white, and ? means that the cell is yet to be colored.
Output
Print a single integer β the answer to the problem.
Examples
Input
1
?W
Output
1
Input
2
??
W?
Output
2
Input
4
BB
??
W?
??
Output
10
Note
In the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.
In the second test case, there are only 2 such colorings:
BB WW and WB WB."
"On an endless checkered sheet of paper, n cells are chosen and colored in three colors, where n is divisible by 3. It turns out that there are exactly n/3 marked cells of each of three colors!
Find the largest such k that it's possible to choose k/3 cells of each color, remove all other marked cells, and then select three rectangles with sides parallel to the grid lines so that the following conditions hold:
* No two rectangles can intersect (but they can share a part of the boundary). In other words, the area of intersection of any two of these rectangles must be 0.
* The i-th rectangle contains all the chosen cells of the i-th color and no chosen cells of other colors, for i = 1, 2, 3.
Input
The first line of the input contains a single integer n β the number of the marked cells (3 β€ n β€ 10^5, n is divisible by 3).
The i-th of the following n lines contains three integers x_i, y_i, c_i (|x_i|,|y_i| β€ 10^9; 1 β€ c_i β€ 3), where (x_i, y_i) are the coordinates of the i-th marked cell and c_i is its color.
It's guaranteed that all cells (x_i, y_i) in the input are distinct, and that there are exactly n/3 cells of each color.
Output
Output a single integer k β the largest number of cells you can leave.
Examples
Input
9
2 3 1
4 1 2
2 1 3
3 4 1
5 3 2
4 4 3
2 4 1
5 2 2
3 5 3
Output
6
Input
3
1 1 1
2 2 2
3 3 3
Output
3
Note
In the first sample, it's possible to leave 6 cells with indexes 1, 5, 6, 7, 8, 9.
In the second sample, it's possible to leave 3 cells with indexes 1, 2, 3."
"For an array c of nonnegative integers, MEX(c) denotes the smallest nonnegative integer that doesn't appear in it. For example, MEX([0, 1, 3]) = 2, MEX([42]) = 0.
You are given integers n, k, and an array [b_1, b_2, β¦, b_n].
Find the number of arrays [a_1, a_2, β¦, a_n], for which the following conditions hold:
* 0 β€ a_i β€ n for each i for each i from 1 to n.
* |MEX([a_1, a_2, β¦, a_i]) - b_i| β€ k for each i from 1 to n.
As this number can be very big, output it modulo 998 244 353.
Input
The first line of the input contains two integers n, k (1 β€ n β€ 2000, 0 β€ k β€ 50).
The second line of the input contains n integers b_1, b_2, β¦, b_n (-k β€ b_i β€ n+k) β elements of the array b.
Output
Output a single integer β the number of arrays which satisfy the conditions from the statement, modulo 998 244 353.
Examples
Input
4 0
0 0 0 0
Output
256
Input
4 1
0 0 0 0
Output
431
Input
4 1
0 0 1 1
Output
509
Input
5 2
0 0 2 2 0
Output
6546
Input
3 2
-2 0 4
Output
11"
"You are given m strings and a tree on n nodes. Each edge has some letter written on it.
You have to answer q queries. Each query is described by 4 integers u, v, l and r. The answer to the query is the total number of occurrences of str(u,v) in strings with indices from l to r. str(u,v) is defined as the string that is made by concatenating letters written on the edges on the shortest path from u to v (in order that they are traversed).
Input
The first line of the input contains three integers n, m and q (2 β€ n β€ 10^5, 1 β€ m,q β€ 10^5).
The i-th of the following n-1 lines contains two integers u_i, v_i and a lowercase Latin letter c_i (1 β€ u_i, v_i β€ n, u_i β v_i), denoting the edge between nodes u_i, v_i with a character c_i on it.
It's guaranteed that these edges form a tree.
The following m lines contain the strings consisting of lowercase Latin letters. The total length of those strings does not exceed 10^5.
Then q lines follow, each containing four integers u, v, l and r (1 β€ u,v β€ n, u β v, 1 β€ l β€ r β€ m), denoting the queries.
Output
For each query print a single integer β the answer to the query.
Examples
Input
2 5 3
1 2 a
aab
abab
aaa
b
a
2 1 1 5
1 2 1 3
2 1 3 5
Output
8
7
4
Input
9 5 6
1 2 a
2 7 c
1 3 b
3 4 b
4 6 b
3 5 a
5 8 b
5 9 c
ababa
cabbb
bac
bbbac
abacaba
2 7 1 4
2 5 1 5
6 3 4 4
6 9 4 5
5 7 3 5
5 3 1 5
Output
3
4
2
1
1
10"
"Monocarp wrote down two numbers on a whiteboard. Both numbers follow a specific format: a positive integer x with p zeros appended to its end.
Now Monocarp asks you to compare these two numbers. Can you help him?
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of testcases.
The first line of each testcase contains two integers x_1 and p_1 (1 β€ x_1 β€ 10^6; 0 β€ p_1 β€ 10^6) β the description of the first number.
The second line of each testcase contains two integers x_2 and p_2 (1 β€ x_2 β€ 10^6; 0 β€ p_2 β€ 10^6) β the description of the second number.
Output
For each testcase print the result of the comparison of the given two numbers. If the first number is smaller than the second one, print '<'. If the first number is greater than the second one, print '>'. If they are equal, print '='.
Example
Input
5
2 1
19 0
10 2
100 1
1999 0
2 3
1 0
1 0
99 0
1 2
Output
>
=
<
=
<
Note
The comparisons in the example are: 20 > 19, 1000 = 1000, 1999 < 2000, 1 = 1, 99 < 100."
"You are given a sequence a_1, a_2, ..., a_n consisting of n pairwise distinct positive integers.
Find \leftβ \frac n 2 \rightβ different pairs of integers x and y such that:
* x β y;
* x and y appear in a;
* x~mod~y doesn't appear in a.
Note that some x or y can belong to multiple pairs.
β x β denotes the floor function β the largest integer less than or equal to x. x~mod~y denotes the remainder from dividing x by y.
If there are multiple solutions, print any of them. It can be shown that at least one solution always exists.
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of testcases.
The first line of each testcase contains a single integer n (2 β€ n β€ 2 β
10^5) β the length of the sequence.
The second line of each testcase contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^6).
All numbers in the sequence are pairwise distinct. The sum of n over all testcases doesn't exceed 2 β
10^5.
Output
The answer for each testcase should contain \leftβ \frac n 2 \rightβ different pairs of integers x and y such that x β y, x and y appear in a and x~mod~y doesn't appear in a. Print the pairs one after another.
You can print the pairs in any order. However, the order of numbers in the pair should be exactly such that the first number is x and the second number is y. All pairs should be pairwise distinct.
If there are multiple solutions, print any of them.
Example
Input
4
2
1 4
4
2 8 3 4
5
3 8 5 9 7
6
2 7 5 3 4 8
Output
4 1
8 2
8 4
9 5
7 5
8 7
4 3
5 2
Note
In the first testcase there are only two pairs: (1, 4) and (4, 1). \leftβ \frac 2 2 \rightβ=1, so we have to find one pair. 1~mod~4=1, and 1 appears in a, so that pair is invalid. Thus, the only possible answer is a pair (4, 1).
In the second testcase, we chose pairs 8~mod~2=0 and 8~mod~4=0. 0 doesn't appear in a, so that answer is valid. There are multiple possible answers for that testcase.
In the third testcase, the chosen pairs are 9~mod~5=4 and 7~mod~5=2. Neither 4, nor 2, appears in a, so that answer is valid."
"Monocarp is playing yet another computer game. In this game, his character has to kill a dragon. The battle with the dragon lasts 100^{500} seconds, during which Monocarp attacks the dragon with a poisoned dagger. The i-th attack is performed at the beginning of the a_i-th second from the battle start. The dagger itself does not deal damage, but it applies a poison effect on the dragon, which deals 1 damage during each of the next k seconds (starting with the same second when the dragon was stabbed by the dagger). However, if the dragon has already been poisoned, then the dagger updates the poison effect (i.e. cancels the current poison effect and applies a new one).
For example, suppose k = 4, and Monocarp stabs the dragon during the seconds 2, 4 and 10. Then the poison effect is applied at the start of the 2-nd second and deals 1 damage during the 2-nd and 3-rd seconds; then, at the beginning of the 4-th second, the poison effect is reapplied, so it deals exactly 1 damage during the seconds 4, 5, 6 and 7; then, during the 10-th second, the poison effect is applied again, and it deals 1 damage during the seconds 10, 11, 12 and 13. In total, the dragon receives 10 damage.
Monocarp knows that the dragon has h hit points, and if he deals at least h damage to the dragon during the battle β he slays the dragon. Monocarp has not decided on the strength of the poison he will use during the battle, so he wants to find the minimum possible value of k (the number of seconds the poison effect lasts) that is enough to deal at least h damage to the dragon.
Input
The first line contains a single integer t (1 β€ t β€ 1000) β the number of test cases.
The first line of the test case contains two integers n and h (1 β€ n β€ 100; 1 β€ h β€ 10^{18}) β the number of Monocarp's attacks and the amount of damage that needs to be dealt.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9; a_i < a_{i + 1}), where a_i is the second when the i-th attack is performed.
Output
For each test case, print a single integer β the minimum value of the parameter k, such that Monocarp will cause at least h damage to the dragon.
Example
Input
4
2 5
1 5
3 10
2 4 10
5 3
1 2 4 5 7
4 1000
3 25 64 1337
Output
3
4
1
470
Note
In the first example, for k=3, damage is dealt in seconds [1, 2, 3, 5, 6, 7].
In the second example, for k=4, damage is dealt in seconds [2, 3, 4, 5, 6, 7, 10, 11, 12, 13].
In the third example, for k=1, damage is dealt in seconds [1, 2, 4, 5, 7]."
"Let's call a sequence of integers x_1, x_2, ..., x_k MEX-correct if for all i (1 β€ i β€ k) |x_i - \operatorname{MEX}(x_1, x_2, ..., x_i)| β€ 1 holds. Where \operatorname{MEX}(x_1, ..., x_k) is the minimum non-negative integer that doesn't belong to the set x_1, ..., x_k. For example, \operatorname{MEX}(1, 0, 1, 3) = 2 and \operatorname{MEX}(2, 1, 5) = 0.
You are given an array a consisting of n non-negative integers. Calculate the number of non-empty MEX-correct subsequences of a given array. The number of subsequences can be very large, so print it modulo 998244353.
Note: a subsequence of an array a is a sequence [a_{i_1}, a_{i_2}, ..., a_{i_m}] meeting the constraints 1 β€ i_1 < i_2 < ... < i_m β€ n. If two different ways to choose the sequence of indices [i_1, i_2, ..., i_m] yield the same subsequence, the resulting subsequence should be counted twice (i. e. two subsequences are different if their sequences of indices [i_1, i_2, ..., i_m] are not the same).
Input
The first line contains a single integer t (1 β€ t β€ 10^5) β the number of test cases.
The first line of each test case contains a single integer n (1 β€ n β€ 5 β
10^5).
The second line contains n integers a_1, a_2, ..., a_n (0 β€ a_i β€ n).
The sum of n over all test cases doesn't exceed 5 β
10^5.
Output
For each test case, print a single integer β the number of non-empty MEX-correct subsequences of a given array, taken modulo 998244353.
Example
Input
4
3
0 2 1
2
1 0
5
0 0 0 0 0
4
0 1 2 3
Output
4
2
31
7
Note
In the first example, the valid subsequences are [0], [1], [0,1] and [0,2].
In the second example, the valid subsequences are [0] and [1].
In the third example, any non-empty subsequence is valid. "
"There is a grid, consisting of n rows and m columns. Each cell of the grid is either free or blocked. One of the free cells contains a lab. All the cells beyond the borders of the grid are also blocked.
A crazy robot has escaped from this lab. It is currently in some free cell of the grid. You can send one of the following commands to the robot: ""move right"", ""move down"", ""move left"" or ""move up"". Each command means moving to a neighbouring cell in the corresponding direction.
However, as the robot is crazy, it will do anything except following the command. Upon receiving a command, it will choose a direction such that it differs from the one in command and the cell in that direction is not blocked. If there is such a direction, then it will move to a neighbouring cell in that direction. Otherwise, it will do nothing.
We want to get the robot to the lab to get it fixed. For each free cell, determine if the robot can be forced to reach the lab starting in this cell. That is, after each step of the robot a command can be sent to a robot such that no matter what different directions the robot chooses, it will end up in a lab.
Input
The first line contains a single integer t (1 β€ t β€ 1000) β the number of testcases.
The first line of each testcase contains two integers n and m (1 β€ n, m β€ 10^6; n β
m β€ 10^6) β the number of rows and the number of columns in the grid.
The i-th of the next n lines provides a description of the i-th row of the grid. It consists of m elements of one of three types:
* '.' β the cell is free;
* '#' β the cell is blocked;
* 'L' β the cell contains a lab.
The grid contains exactly one lab. The sum of n β
m over all testcases doesn't exceed 10^6.
Output
For each testcase find the free cells that the robot can be forced to reach the lab from. Given the grid, replace the free cells (marked with a dot) with a plus sign ('+') for the cells that the robot can be forced to reach the lab from. Print the resulting grid.
Example
Input
4
3 3
...
.L.
...
4 5
#....
..##L
...#.
.....
1 1
L
1 9
....L..#.
Output
...
.L.
...
#++++
..##L
...#+
...++
L
++++L++#.
Note
In the first testcase there is no free cell that the robot can be forced to reach the lab from. Consider a corner cell. Given any direction, it will move to a neighbouring border grid that's not a corner. Now consider a non-corner free cell. No matter what direction you send to the robot, it can choose a different direction such that it ends up in a corner.
In the last testcase, you can keep sending the command that is opposite to the direction to the lab and the robot will have no choice other than move towards the lab."
"You are given a rooted tree consisting of n vertices numbered from 1 to n. The root of the tree is the vertex 1.
You have to color all vertices of the tree into n colors (also numbered from 1 to n) so that there is exactly one vertex for each color. Let c_i be the color of vertex i, and p_i be the parent of vertex i in the rooted tree. The coloring is considered beautiful if there is no vertex k (k > 1) such that c_k = c_{p_k} - 1, i. e. no vertex such that its color is less than the color of its parent by exactly 1.
Calculate the number of beautiful colorings, and print it modulo 998244353.
Input
The first line contains one integer n (2 β€ n β€ 250000) β the number of vertices in the tree.
Then n-1 lines follow, the i-th line contains two integers x_i and y_i (1 β€ x_i, y_i β€ n; x_i β y_i) denoting an edge between the vertex x_i and the vertex y_i. These edges form a tree.
Output
Print one integer β the number of beautiful colorings, taken modulo 998244353.
Examples
Input
5
1 2
3 2
4 2
2 5
Output
42
Input
5
1 2
2 3
3 4
4 5
Output
53
Input
20
20 19
20 4
12 4
5 8
1 2
20 7
3 10
7 18
11 8
9 10
17 10
1 15
11 16
14 11
18 10
10 1
14 2
13 17
20 6
Output
955085064"
"There are n block towers in a row, where tower i has a height of a_i. You're part of a building crew, and you want to make the buildings look as nice as possible. In a single day, you can perform the following operation:
* Choose two indices i and j (1 β€ i, j β€ n; i β j), and move a block from tower i to tower j. This essentially decreases a_i by 1 and increases a_j by 1.
You think the ugliness of the buildings is the height difference between the tallest and shortest buildings. Formally, the ugliness is defined as max(a)-min(a).
What's the minimum possible ugliness you can achieve, after any number of days?
Input
The first line contains one integer t (1 β€ t β€ 1000) β the number of test cases. Then t cases follow.
The first line of each test case contains one integer n (2 β€ n β€ 100) β the number of buildings.
The second line of each test case contains n space separated integers a_1, a_2, β¦, a_n (1 β€ a_i β€ 10^7) β the heights of the buildings.
Output
For each test case, output a single integer β the minimum possible ugliness of the buildings.
Example
Input
3
3
10 10 10
4
3 2 1 2
5
1 2 3 1 5
Output
0
0
1
Note
In the first test case, the ugliness is already 0.
In the second test case, you should do one operation, with i = 1 and j = 3. The new heights will now be [2, 2, 2, 2], with an ugliness of 0.
In the third test case, you may do three operations:
1. with i = 3 and j = 1. The new array will now be [2, 2, 2, 1, 5],
2. with i = 5 and j = 4. The new array will now be [2, 2, 2, 2, 4],
3. with i = 5 and j = 3. The new array will now be [2, 2, 3, 2, 3].
The resulting ugliness is 1. It can be proven that this is the minimum possible ugliness for this test."
"You are given an array consisting of all integers from [l, r] inclusive. For example, if l = 2 and r = 5, the array would be [2, 3, 4, 5]. What's the minimum number of elements you can delete to make the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of the array non-zero?
A bitwise AND is a binary operation that takes two equal-length binary representations and performs the AND operation on each pair of the corresponding bits.
Input
The first line contains one integer t (1 β€ t β€ 10^4) β the number of test cases. Then t cases follow.
The first line of each test case contains two integers l and r (1 β€ l β€ r β€ 2 β
10^5) β the description of the array.
Output
For each test case, output a single integer β the answer to the problem.
Example
Input
5
1 2
2 8
4 5
1 5
100000 200000
Output
1
3
0
2
31072
Note
In the first test case, the array is [1, 2]. Currently, the bitwise AND is 0, as 1\ \& \ 2 = 0. However, after deleting 1 (or 2), the array becomes [2] (or [1]), and the bitwise AND becomes 2 (or 1). This can be proven to be the optimal, so the answer is 1.
In the second test case, the array is [2, 3, 4, 5, 6, 7, 8]. Currently, the bitwise AND is 0. However, after deleting 4, 5, and 8, the array becomes [2, 3, 6, 7], and the bitwise AND becomes 2. This can be proven to be the optimal, so the answer is 3. Note that there may be other ways to delete 3 elements."
"There are n candles on a Hanukkah menorah, and some of its candles are initially lit. We can describe which candles are lit with a binary string s, where the i-th candle is lit if and only if s_i=1.
<image>
Initially, the candle lights are described by a string a. In an operation, you select a candle that is currently lit. By doing so, the candle you selected will remain lit, and every other candle will change (if it was lit, it will become unlit and if it was unlit, it will become lit).
You would like to make the candles look the same as string b. Your task is to determine if it is possible, and if it is, find the minimum number of operations required.
Input
The first line contains an integer t (1β€ tβ€ 10^4) β the number of test cases. Then t cases follow.
The first line of each test case contains a single integer n (1β€ nβ€ 10^5) β the number of candles.
The second line contains a string a of length n consisting of symbols 0 and 1 β the initial pattern of lights.
The third line contains a string b of length n consisting of symbols 0 and 1 β the desired pattern of lights.
It is guaranteed that the sum of n does not exceed 10^5.
Output
For each test case, output the minimum number of operations required to transform a to b, or -1 if it's impossible.
Example
Input
5
5
11010
11010
2
01
11
3
000
101
9
100010111
101101100
9
001011011
011010101
Output
0
1
-1
3
4
Note
In the first test case, the two strings are already equal, so we don't have to perform any operations.
In the second test case, we can perform a single operation selecting the second candle to transform 01 into 11.
In the third test case, it's impossible to perform any operations because there are no lit candles to select.
In the fourth test case, we can perform the following operations to transform a into b:
1. Select the 7-th candle: 100010{\color{red}1}11β 011101{\color{red} 1}00.
2. Select the 2-nd candle: 0{\color{red} 1}1101100β 1{\color{red} 1}0010011.
3. Select the 1-st candle: {\color{red}1}10010011β {\color{red}1}01101100.
In the fifth test case, we can perform the following operations to transform a into b:
1. Select the 6-th candle: 00101{\color{red}1}011β 11010{\color{red}1}100
2. Select the 2-nd candle: 1{\color{red}1}0101100β 0{\color{red}1}1010011
3. Select the 8-th candle: 0110100{\color{red}1}1β 1001011{\color{red}1}0
4. Select the 7-th candle: 100101{\color{red}1}10β 011010{\color{red}1}01 "
"'Twas the night before Christmas, and Santa's frantically setting up his new Christmas tree! There are n nodes in the tree, connected by n-1 edges. On each edge of the tree, there's a set of Christmas lights, which can be represented by an integer in binary representation.
<image>
He has m elves come over and admire his tree. Each elf is assigned two nodes, a and b, and that elf looks at all lights on the simple path between the two nodes. After this, the elf's favorite number becomes the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of the values of the lights on the edges in that path.
However, the North Pole has been recovering from a nasty bout of flu. Because of this, Santa forgot some of the configurations of lights he had put on the tree, and he has already left the North Pole! Fortunately, the elves came to the rescue, and each one told Santa what pair of nodes he was assigned (a_i, b_i), as well as the parity of the number of set bits in his favorite number. In other words, he remembers whether the number of 1's when his favorite number is written in binary is odd or even.
Help Santa determine if it's possible that the memories are consistent, and if it is, remember what his tree looked like, and maybe you'll go down in history!
Input
The first line contains one integer t (1 β€ t β€ 2 β
10^4) β the number of test cases. Then t cases follow.
The first line of each test case contains two integers, n and m (2 β€ n β€ 2 β
10^5; 1 β€ m β€ 2 β
10^5) β the size of tree and the number of elves respectively.
The next n-1 lines of each test case each contains three integers, x, y, and v (1 β€ x, y β€ n; -1 β€ v < 2^{30}) β meaning that there's an edge between nodes x and y. If
* v = -1: Santa doesn't remember what the set of lights were on for this edge.
* v β₯ 0: The set of lights on the edge is v.
The next m lines of each test case each contains three integers, a, b, and p (1 β€ a, b β€ n; a β b; 0 β€ p β€ 1) β the nodes that the elf was assigned to, and the parity of the number of set bits in the elf's favorite number.
It is guaranteed that the sum of all n and the sum of all m don't exceed 2 β
10^5 each.
It is guaranteed that the given edges form a tree.
Output
For each test case, first print either YES or NO (in any case), whether there's a tree consistent with Santa's memory or not.
If the answer is YES, print n-1 lines each containing three integers: x, y, and v (1 β€ x, y β€ n; 0 β€ v < 2^{30}) β the edge and the integer on that edge. The set of edges must be the same as in the input, and if the value of some edge was specified earlier, it can not change. You can print the edges in any order.
If there are multiple answers, print any.
Example
Input
4
6 5
1 2 -1
1 3 1
4 2 7
6 3 0
2 5 -1
2 3 1
2 5 0
5 6 1
6 1 1
4 5 1
5 3
1 2 -1
1 3 -1
1 4 1
4 5 -1
2 4 0
3 4 1
2 3 1
3 3
1 2 -1
1 3 -1
1 2 0
1 3 1
2 3 0
2 1
1 2 1
1 2 0
Output
YES
1 2 0
1 3 1
2 4 7
3 6 0
2 5 0
YES
1 2 1
1 3 0
1 4 1
4 5 1
NO
NO
Note
The first test case is the image in the statement.
One possible answer is assigning the value of the edge (1, 2) to 5, and the value of the edge (2, 5) to 3. This is correct because:
* The first elf goes from node 2 to node 3. This elf's favorite number is 4, so he remembers the value 1 (as 4 has an odd number of 1 bits in its binary representation).
* The second elf goes from node 2 to node 5. This elf's favorite number is 3, so he remembers the value 0 (as 3 has an even number of 1 bits in its binary representation).
* The third elf goes from node 5 to node 6. This elf's favorite number is 7, so he remembers the value 1 (as 7 has an odd number of 1 bits in its binary representation).
* The fourth elf goes from node 6 to node 1. This elf's favorite number is 1, so he remembers the value 1 (as 1 has an odd number of 1 bits in its binary representation).
* The fifth elf goes from node 4 to node 5. This elf's favorite number is 4, so he remembers the number 1 (as 4 has an odd number of 1 bits in its binary representation).
Note that there are other possible answers."
"Two players, Red and Blue, are at it again, and this time they're playing with crayons! The mischievous duo is now vandalizing a rooted tree, by coloring the nodes while playing their favorite game.
The game works as follows: there is a tree of size n, rooted at node 1, where each node is initially white. Red and Blue get one turn each. Red goes first.
In Red's turn, he can do the following operation any number of times:
* Pick any subtree of the rooted tree, and color every node in the subtree red.
However, to make the game fair, Red is only allowed to color k nodes of the tree. In other words, after Red's turn, at most k of the nodes can be colored red.
Then, it's Blue's turn. Blue can do the following operation any number of times:
* Pick any subtree of the rooted tree, and color every node in the subtree blue. However, he's not allowed to choose a subtree that contains a node already colored red, as that would make the node purple and no one likes purple crayon.
Note: there's no restriction on the number of nodes Blue can color, as long as he doesn't color a node that Red has already colored.
After the two turns, the score of the game is determined as follows: let w be the number of white nodes, r be the number of red nodes, and b be the number of blue nodes. The score of the game is w β
(r - b).
Red wants to maximize this score, and Blue wants to minimize it. If both players play optimally, what will the final score of the game be?
Input
The first line contains two integers n and k (2 β€ n β€ 2 β
10^5; 1 β€ k β€ n) β the number of vertices in the tree and the maximum number of red nodes.
Next n - 1 lines contains description of edges. The i-th line contains two space separated integers u_i and v_i (1 β€ u_i, v_i β€ n; u_i β v_i) β the i-th edge of the tree.
It's guaranteed that given edges form a tree.
Output
Print one integer β the resulting score if both Red and Blue play optimally.
Examples
Input
4 2
1 2
1 3
1 4
Output
1
Input
5 2
1 2
2 3
3 4
4 5
Output
6
Input
7 2
1 2
1 3
4 2
3 5
6 3
6 7
Output
4
Input
4 1
1 2
1 3
1 4
Output
-1
Note
In the first test case, the optimal strategy is as follows:
* Red chooses to color the subtrees of nodes 2 and 3.
* Blue chooses to color the subtree of node 4.
At the end of this process, nodes 2 and 3 are red, node 4 is blue, and node 1 is white. The score of the game is 1 β
(2 - 1) = 1.
In the second test case, the optimal strategy is as follows:
* Red chooses to color the subtree of node 4. This colors both nodes 4 and 5.
* Blue does not have any options, so nothing is colored blue.
At the end of this process, nodes 4 and 5 are red, and nodes 1, 2 and 3 are white. The score of the game is 3 β
(2 - 0) = 6.
For the third test case:
<image>
The score of the game is 4 β
(2 - 1) = 4."
"After getting bored by playing with crayons, you decided to switch to Legos! Today, you're working with a long strip, with height 1 and length n, some positions of which are occupied by 1 by 1 Lego pieces.
In one second, you can either remove two adjacent Lego pieces from the strip (if both are present), or add two Lego pieces to adjacent positions (if both are absent). You can only add or remove Lego's at two adjacent positions at the same time, as otherwise your chubby fingers run into precision issues.
You want to know exactly how much time you'll spend playing with Legos. You value efficiency, so given some starting state and some ending state, you'll always spend the least number of seconds to transform the starting state into the ending state. If it's impossible to transform the starting state into the ending state, you just skip it (so you spend 0 seconds).
The issue is that, for some positions, you don't remember whether there were Legos there or not (in either the starting state, the ending state, or both). Over all pairs of (starting state, ending state) that are consistent with your memory, find the total amount of time it will take to transform the starting state to the ending state. Print this value modulo 1 000 000 007 (10^9 + 7).
Input
The first line contains one integer t (1 β€ t β€ 1000) β the number of test cases. Then t cases follow.
The first line of each test case contains one integer n (2 β€ n β€ 2000) β the size of the Lego strip.
The second line of each test case contains a string s of length n, consisting of the characters 0, 1, and ? β your memory of the starting state:
* 1 represents a position that definitely has a Lego piece,
* 0 represents a position that definitely does not have a Lego piece,
* and ? represents a position that you don't remember.
The third line of each test case contains a string t of length n, consisting of the characters 0, 1, and ? β your memory of the ending state. It follows a similar format to the starting state.
It's guaranteed that the sum of n over all test cases doesn't exceed 2000.
Output
For each test case, output a single integer β the answer to the problem modulo 1 000 000 007 (10^9 + 7).
Example
Input
6
2
00
11
3
???
???
3
??1
0?0
4
??0?
??11
5
?????
0??1?
10
?01??01?1?
??100?1???
Output
1
16
1
14
101
1674
Note
For the first test case, 00 is the only possible starting state, and 11 is the only possible ending state. It takes exactly one operation to change 00 to 11.
For the second test case, some of the possible starting and ending state pairs are:
* (000, 011) β takes 1 operation.
* (001, 100) β takes 2 operations.
* (010, 000) β takes 0 operations, as it's impossible to achieve the ending state. "
"You are given an array a consisting of n non-negative integers.
You have to replace each 0 in a with an integer from 1 to n (different elements equal to 0 can be replaced by different integers).
The value of the array you obtain is the number of integers k from 1 to n such that the following condition holds: there exist a pair of adjacent elements equal to k (i. e. there exists some i β [1, n - 1] such that a_i = a_{i + 1} = k). If there are multiple such pairs for some integer k, this integer is counted in the value only once.
Your task is to obtain the array with the maximum possible value.
Input
The first line contains one integer n (2 β€ n β€ 3 β
10^5) β the number of elements in the array.
The second line contains n integers a_1, a_2, ..., a_n (0 β€ a_i β€ min(n, 600)) β the elements of the array.
Output
Print n integers not less than 1 and not greater than n β the array with the maximum possible value you can obtain.
If there are multiple answers, print any of them.
Examples
Input
4
1 1 0 2
Output
1 1 2 2
Input
5
0 0 0 0 0
Output
3 1 1 3 3
Input
5
1 2 3 4 5
Output
1 2 3 4 5
Input
6
1 0 0 0 0 1
Output
1 2 3 3 1 1
Input
3
3 0 2
Output
3 2 2
Input
5
1 0 2 0 1
Output
1 2 2 1 1
Input
7
1 0 2 3 1 0 2
Output
1 2 2 3 1 1 2 "
"There are n reindeer at the North Pole, all battling for the highest spot on the ""Top Reindeer"" leaderboard on the front page of CodeNorses (a popular competitive reindeer gaming website). Interestingly, the ""Top Reindeer"" title is just a measure of upvotes and has nothing to do with their skill level in the reindeer games, but they still give it the utmost importance.
Currently, the i-th reindeer has a score of a_i. You would like to influence the leaderboard with some operations. In an operation, you can choose a reindeer, and either increase or decrease his score by 1 unit. Negative scores are allowed.
You have m requirements for the resulting scores. Each requirement is given by an ordered pair (u, v), meaning that after all operations, the score of reindeer u must be less than or equal to the score of reindeer v.
Your task is to perform the minimum number of operations so that all requirements will be satisfied.
Input
The first line contains two integers n and m (2β€ nβ€ 1000; 1β€ mβ€ 1000) β the number of reindeer and requirements, respectively.
The second line contains n integers a_1,β¦, a_n (1β€ a_iβ€ 10^9), where a_i is the current score of reindeer i.
The next m lines describe the requirements.
The i-th of these lines contains two integers u_i and v_i (1β€ u_i, v_iβ€ n; u_iβ v_i) β the two reindeer of the i-th requirement.
Output
Print n integers b_1,β¦, b_n (-10^{15}β€ b_iβ€ 10^{15}), where b_i is the score of the i-th reindeer after all operations.
If there are multiple solutions achieving the minimum number of operations, you may output any.
We can prove that there is always an optimal solution such that |b_i|β€ 10^{15} for all i.
Examples
Input
7 6
3 1 4 9 2 5 6
1 2
2 3
3 4
4 5
5 6
6 7
Output
1 1 4 4 4 5 6
Input
4 6
6 5 8 2
3 1
4 1
3 2
1 2
2 3
3 1
Output
6 6 6 2
Input
10 18
214 204 195 182 180 176 176 172 169 167
1 2
3 2
4 2
5 2
6 2
7 2
8 2
9 2
10 2
6 1
6 2
6 3
6 4
6 5
6 7
6 8
6 9
6 10
Output
204 204 195 182 180 167 176 172 169 167 "
"You are given strings S and T, consisting of lowercase English letters. It is guaranteed that T is a permutation of the string abc.
Find string S', the lexicographically smallest permutation of S such that T is not a subsequence of S'.
String a is a permutation of string b if the number of occurrences of each distinct character is the same in both strings.
A string a is a subsequence of a string b if a can be obtained from b by deletion of several (possibly, zero or all) elements.
A string a is lexicographically smaller than a string b if and only if one of the following holds:
* a is a prefix of b, but a β b;
* in the first position where a and b differ, the string a has a letter that appears earlier in the alphabet than the corresponding letter in b.
Input
Each test contains multiple test cases. The first line contains a single integer t (1 β€ t β€ 1000) β the number of test cases. Description of the test cases follows.
The first line of each test case contains a string S (1 β€ |S| β€ 100), consisting of lowercase English letters.
The second line of each test case contains a string T that is a permutation of the string abc. (Hence, |T| = 3).
Note that there is no limit on the sum of |S| across all test cases.
Output
For each test case, output a single string S', the lexicographically smallest permutation of S such that T is not a subsequence of S'.
Example
Input
7
abacaba
abc
cccba
acb
dbsic
bac
abracadabra
abc
dddddddddddd
cba
bbc
abc
ac
abc
Output
aaaacbb
abccc
bcdis
aaaaacbbdrr
dddddddddddd
bbc
ac
Note
In the first test case, both aaaabbc and aaaabcb are lexicographically smaller than aaaacbb, but they contain abc as a subsequence.
In the second test case, abccc is the smallest permutation of cccba and does not contain acb as a subsequence.
In the third test case, bcdis is the smallest permutation of dbsic and does not contain bac as a subsequence."
"Given a positive integer n. Find three distinct positive integers a, b, c such that a + b + c = n and \operatorname{gcd}(a, b) = c, where \operatorname{gcd}(x, y) denotes the [greatest common divisor (GCD)](https://en.wikipedia.org/wiki/Greatest_common_divisor) of integers x and y.
Input
The input consists of multiple test cases. The first line contains a single integer t (1 β€ t β€ 10^5) β the number of test cases. Description of the test cases follows.
The first and only line of each test case contains a single integer n (10 β€ n β€ 10^9).
Output
For each test case, output three distinct positive integers a, b, c satisfying the requirements. If there are multiple solutions, you can print any. We can show that an answer always exists.
Example
Input
6
18
63
73
91
438
122690412
Output
6 9 3
21 39 3
29 43 1
49 35 7
146 219 73
28622 122661788 2
Note
In the first test case, 6 + 9 + 3 = 18 and \operatorname{gcd}(6, 9) = 3.
In the second test case, 21 + 39 + 3 = 63 and \operatorname{gcd}(21, 39) = 3.
In the third test case, 29 + 43 + 1 = 73 and \operatorname{gcd}(29, 43) = 1."
"Paprika loves permutations. She has an array a_1, a_2, ..., a_n. She wants to make the array a permutation of integers 1 to n.
In order to achieve this goal, she can perform operations on the array. In each operation she can choose two integers i (1 β€ i β€ n) and x (x > 0), then perform a_i := a_i mod x (that is, replace a_i by the remainder of a_i divided by x). In different operations, the chosen i and x can be different.
Determine the minimum number of operations needed to make the array a permutation of integers 1 to n. If it is impossible, output -1.
A permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appears twice in the array) and [1,3,4] is also not a permutation (n=3 but there is 4 in the array).
Input
Each test contains multiple test cases. The first line contains a single integer t (1 β€ t β€ 10^4) β the number of test cases. Description of the test cases follows.
The first line of each test case contains an integer n (1 β€ n β€ 10^5).
The second line of each test case contains n integers a_1, a_2, ..., a_n. (1 β€ a_i β€ 10^9).
It is guaranteed that the sum of n over all test cases does not exceed 2 β
10^5.
Output
For each test case, output the minimum number of operations needed to make the array a permutation of integers 1 to n, or -1 if it is impossible.
Example
Input
4
2
1 7
3
1 5 4
4
12345678 87654321 20211218 23571113
9
1 2 3 4 18 19 5 6 7
Output
1
-1
4
2
Note
For the first test, the only possible sequence of operations which minimizes the number of operations is:
* Choose i=2, x=5. Perform a_2 := a_2 mod 5 = 2.
For the second test, it is impossible to obtain a permutation of integers from 1 to n."
"This is an interactive problem. The only difference between the easy and hard version is the limit on number of questions.
There are n players labelled from 1 to n. It is guaranteed that n is a multiple of 3.
Among them, there are k impostors and n-k crewmates. The number of impostors, k, is not given to you. It is guaranteed that n/3 < k < 2n/3.
In each question, you can choose three distinct integers a, b, c (1 β€ a, b, c β€ n) and ask: ""Among the players labelled a, b and c, are there more impostors or more crewmates?"" You will be given the integer 0 if there are more impostors than crewmates, and 1 otherwise.
Find the number of impostors k and the indices of players that are impostors after asking at most n+6 questions.
The jury is adaptive, which means the indices of impostors may not be fixed beforehand and can depend on your questions. It is guaranteed that there is at least one set of impostors which fulfills the constraints and the answers to your questions at any time.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 100). Description of the test cases follows.
The first and only line of each test case contains a single integer n (6 β€ n < 10^4, n is a multiple of 3) β the number of players.
It is guaranteed that the sum of n over all test cases does not exceed 2 β
10^4.
Interaction
For each test case, the interaction starts with reading n.
Then you are allowed to make at most n+6 questions in the following way:
""? a b c"" (1 β€ a, b, c β€ n, a, b and c are pairwise distinct).
After each one, you should read an integer r, which is equal to 0 if there are more impostors than crewmates among players labelled a, b and c, and equal to 1 otherwise.
Answer -1 instead of 0 or 1 means that you made an invalid query. Exit immediately after receiving -1 and you will see Wrong answer verdict. Otherwise you can get an arbitrary verdict because your solution will continue to read from a closed stream.
When you have found the indices of all impostors, print a single line ""! "" (without quotes), followed by the number of impostors k, followed by k integers representing the indices of the impostors. Please note that you must print all this information on the same line.
After printing the answer, your program must then continue to solve the remaining test cases, or exit if all test cases have been solved.
After printing the queries and answers do not forget to output end of line and flush the output buffer. Otherwise, you will get the Idleness limit exceeded verdict. To do flush use:
* fflush(stdout) or cout.flush() in C++;
* System.out.flush() in Java;
* flush(output) in Pascal;
* stdout.flush() in Python;
* Read documentation for other languages.
Hacks
You cannot make hacks in this problem.
Example
Input
2
6
0
1
9
1
Output
? 1 2 3
? 3 4 5
! 3 4 1 2
? 7 1 9
! 4 2 3 6 8
Note
Explanation for example interaction (note that this example only exists to demonstrate the interaction procedure and does not provide any hint for the solution):
For the first test case:
Question ""? 1 2 3"" returns 0, so there are more impostors than crewmates among players 1, 2 and 3.
Question ""? 3 4 5"" returns 1, so there are more crewmates than impostors among players 3, 4 and 5.
Outputting ""! 3 4 1 2"" means that one has found all the impostors, by some miracle. There are k = 3 impostors. The players who are impostors are players 4, 1 and 2.
For the second test case:
Question ""? 7 1 9"" returns 1, so there are more crewmates than impostors among players 7, 1 and 9.
Outputting ""! 4 2 3 6 8"" means that one has found all the impostors, by some miracle. There are k = 4 impostors. The players who are impostors are players 2, 3, 6 and 8."
"Christmas is coming, Icy has just received a box of chocolates from her grandparents! The box contains n chocolates. The i-th chocolate has a non-negative integer type a_i.
Icy believes that good things come in pairs. Unfortunately, all types of chocolates are distinct (all a_i are distinct). Icy wants to make at least one pair of chocolates the same type.
As a result, she asks her grandparents to perform some chocolate exchanges. Before performing any chocolate exchanges, Icy chooses two chocolates with indices x and y (1 β€ x, y β€ n, x β y).
In a chocolate exchange, Icy's grandparents choose a non-negative integer k, such that 2^k β₯ a_x, and change the type of the chocolate x from a_x to 2^k - a_x (that is, perform a_x := 2^k - a_x).
The chocolate exchanges will be stopped only when a_x = a_y. Note that other pairs of equal chocolate types do not stop the procedure.
Icy's grandparents are smart, so they would choose the sequence of chocolate exchanges that minimizes the number of exchanges needed. Since Icy likes causing trouble, she wants to maximize the minimum number of exchanges needed by choosing x and y appropriately. She wonders what is the optimal pair (x, y) such that the minimum number of exchanges needed is maximized across all possible choices of (x, y).
Since Icy is not good at math, she hopes that you can help her solve the problem.
Input
The first line of the input contains a single integer n (2 β€ n β€ 2 β
10^5) β the number of chocolates.
The second line of the input contains n integers a_1, a_2, ..., a_n (0 β€ a_i β€ 10^9).
It is guaranteed that all a_i are distinct.
Output
Output three integers x, y, and m.
x and y are indices of the optimal chocolates to perform exchanges on. Your output must satisfy 1 β€ x, y β€ n, x β y.
m is the number of exchanges needed to obtain a_x = a_y. We can show that m β€ 10^9 for any pair of chocolates.
If there are multiple solutions, output any.
Examples
Input
5
5 6 7 8 9
Output
2 5 5
Input
2
4 8
Output
1 2 2
Note
In the first test case, the minimum number of exchanges needed to exchange a chocolate of type 6 to a chocolate of type 9 is 5. The sequence of exchanges is as follows: 6 β 2 β 0 β 1 β 7 β 9.
In the second test case, the minimum number of exchanges needed to exchange a chocolate of type 4 to a chocolate of type 8 is 2. The sequence of exchanges is as follows: 4 β 0 β 8."
"Polycarp had an array a of 3 positive integers. He wrote out the sums of all non-empty subsequences of this array, sorted them in non-decreasing order, and got an array b of 7 integers.
For example, if a = \{1, 4, 3\}, then Polycarp wrote out 1, 4, 3, 1 + 4 = 5, 1 + 3 = 4, 4 + 3 = 7, 1 + 4 + 3 = 8. After sorting, he got an array b = \{1, 3, 4, 4, 5, 7, 8\}.
Unfortunately, Polycarp lost the array a. He only has the array b left. Help him to restore the array a.
Input
The first line contains one integer t (1 β€ t β€ 5000) β the number of test cases.
Each test case consists of one line which contains 7 integers b_1, b_2, ..., b_7 (1 β€ b_i β€ 10^9; b_i β€ b_{i+1}).
Additional constraint on the input: there exists at least one array a which yields this array b as described in the statement.
Output
For each test case, print 3 integers β a_1, a_2 and a_3. If there can be several answers, print any of them.
Example
Input
5
1 3 4 4 5 7 8
1 2 3 4 5 6 7
300000000 300000000 300000000 600000000 600000000 600000000 900000000
1 1 2 999999998 999999999 999999999 1000000000
1 2 2 3 3 4 5
Output
1 4 3
4 1 2
300000000 300000000 300000000
999999998 1 1
1 2 2
Note
The subsequence of the array a is a sequence that can be obtained from a by removing zero or more of its elements.
Two subsequences are considered different if index sets of elements included in them are different. That is, the values of the elements don't matter in the comparison of subsequences. In particular, any array of length 3 has exactly 7 different non-empty subsequences."
"Polycarp has come up with a new game to play with you. He calls it ""A missing bigram"".
A bigram of a word is a sequence of two adjacent letters in it.
For example, word ""abbaaba"" contains bigrams ""ab"", ""bb"", ""ba"", ""aa"", ""ab"" and ""ba"".
The game goes as follows. First, Polycarp comes up with a word, consisting only of lowercase letters 'a' and 'b'. Then, he writes down all its bigrams on a whiteboard in the same order as they appear in the word. After that, he wipes one of them off the whiteboard.
Finally, Polycarp invites you to guess what the word that he has come up with was.
Your goal is to find any word such that it's possible to write down all its bigrams and remove one of them, so that the resulting sequence of bigrams is the same as the one Polycarp ended up with.
The tests are generated in such a way that the answer exists. If there are multiple answers, you can print any of them.
Input
The first line contains a single integer t (1 β€ t β€ 2000) β the number of testcases.
The first line of each testcase contains a single integer n (3 β€ n β€ 100) β the length of the word Polycarp has come up with.
The second line of each testcase contains n-2 bigrams of that word, separated by a single space. Each bigram consists of two letters, each of them is either 'a' or 'b'.
Additional constraint on the input: there exists at least one string such that it is possible to write down all its bigrams, except one, so that the resulting sequence is the same as the sequence in the input. In other words, the answer exists.
Output
For each testcase print a word, consisting of n letters, each of them should be either 'a' or 'b'. It should be possible to write down all its bigrams and remove one of them, so that the resulting sequence of bigrams is the same as the one Polycarp ended up with.
The tests are generated in such a way that the answer exists. If there are multiple answers, you can print any of them.
Example
Input
4
7
ab bb ba aa ba
7
ab ba aa ab ba
3
aa
5
bb ab bb
Output
abbaaba
abaabaa
baa
bbabb
Note
The first two testcases from the example are produced from the word ""abbaaba"". As listed in the statement, it contains bigrams ""ab"", ""bb"", ""ba"", ""aa"", ""ab"" and ""ba"".
In the first testcase, the 5-th bigram is removed.
In the second testcase, the 2-nd bigram is removed. However, that sequence could also have been produced from the word ""abaabaa"". It contains bigrams ""ab"", ""ba"", ""aa"", ""ab"", ""ba"" and ""aa"". The missing bigram is the 6-th one.
In the third testcase, all of ""baa"", ""aab"" and ""aaa"" are valid answers."
"You are given an array a consisting of n positive integers. You have to choose a positive integer d and paint all elements into two colors. All elements which are divisible by d will be painted red, and all other elements will be painted blue.
The coloring is called beautiful if there are no pairs of adjacent elements with the same color in the array. Your task is to find any value of d which yields a beautiful coloring, or report that it is impossible.
Input
The first line contains a single integer t (1 β€ t β€ 1000) β the number of testcases.
The first line of each testcase contains one integer n (2 β€ n β€ 100) β the number of elements of the array.
The second line of each testcase contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^{18}).
Output
For each testcase print a single integer. If there is no such value of d that yields a beautiful coloring, print 0. Otherwise, print any suitable value of d (1 β€ d β€ 10^{18}).
Example
Input
5
5
1 2 3 4 5
3
10 5 15
3
100 10 200
10
9 8 2 6 6 2 8 6 5 4
2
1 3
Output
2
0
100
0
3"
"You are given an array a of n integers, and another integer k such that 2k β€ n.
You have to perform exactly k operations with this array. In one operation, you have to choose two elements of the array (let them be a_i and a_j; they can be equal or different, but their positions in the array must not be the same), remove them from the array, and add β (a_i)/(a_j) β to your score, where β x/y β is the maximum integer not exceeding x/y.
Initially, your score is 0. After you perform exactly k operations, you add all the remaining elements of the array to the score.
Calculate the minimum possible score you can get.
Input
The first line of the input contains one integer t (1 β€ t β€ 500) β the number of test cases.
Each test case consists of two lines. The first line contains two integers n and k (1 β€ n β€ 100; 0 β€ k β€ β n/2 β).
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 2 β
10^5).
Output
Print one integer β the minimum possible score you can get.
Example
Input
5
7 3
1 1 1 2 1 3 1
5 1
5 5 5 5 5
4 2
1 3 3 7
2 0
4 2
9 2
1 10 10 1 10 2 7 10 3
Output
2
16
0
6
16
Note
Let's consider the example test.
In the first test case, one way to obtain a score of 2 is the following one:
1. choose a_7 = 1 and a_4 = 2 for the operation; the score becomes 0 + β 1/2 β = 0, the array becomes [1, 1, 1, 1, 3];
2. choose a_1 = 1 and a_5 = 3 for the operation; the score becomes 0 + β 1/3 β = 0, the array becomes [1, 1, 1];
3. choose a_1 = 1 and a_2 = 1 for the operation; the score becomes 0 + β 1/1 β = 1, the array becomes [1];
4. add the remaining element 1 to the score, so the resulting score is 2.
In the second test case, no matter which operations you choose, the resulting score is 16.
In the third test case, one way to obtain a score of 0 is the following one:
1. choose a_1 = 1 and a_2 = 3 for the operation; the score becomes 0 + β 1/3 β = 0, the array becomes [3, 7];
2. choose a_1 = 3 and a_2 = 7 for the operation; the score becomes 0 + β 3/7 β = 0, the array becomes empty;
3. the array is empty, so the score doesn't change anymore.
In the fourth test case, no operations can be performed, so the score is the sum of the elements of the array: 4 + 2 = 6."
"n towns are arranged in a circle sequentially. The towns are numbered from 1 to n in clockwise order. In the i-th town, there lives a singer with a repertoire of a_i minutes for each i β [1, n].
Each singer visited all n towns in clockwise order, starting with the town he lives in, and gave exactly one concert in each town. In addition, in each town, the i-th singer got inspired and came up with a song that lasts a_i minutes. The song was added to his repertoire so that he could perform it in the rest of the cities.
Hence, for the i-th singer, the concert in the i-th town will last a_i minutes, in the (i + 1)-th town the concert will last 2 β
a_i minutes, ..., in the ((i + k) mod n + 1)-th town the duration of the concert will be (k + 2) β
a_i, ..., in the town ((i + n - 2) mod n + 1) β n β
a_i minutes.
You are given an array of b integer numbers, where b_i is the total duration of concerts in the i-th town. Reconstruct any correct sequence of positive integers a or say that it is impossible.
Input
The first line contains one integer t (1 β€ t β€ 10^3) β the number of test cases. Then the test cases follow.
Each test case consists of two lines. The first line contains a single integer n (1 β€ n β€ 4 β
10^4) β the number of cities. The second line contains n integers b_1, b_2, ..., b_n (1 β€ b_i β€ 10^{9}) β the total duration of concerts in i-th city.
The sum of n over all test cases does not exceed 2 β
10^5.
Output
For each test case, print the answer as follows:
If there is no suitable sequence a, print NO. Otherwise, on the first line print YES, on the next line print the sequence a_1, a_2, ..., a_n of n integers, where a_i (1 β€ a_i β€ 10^{9}) is the initial duration of repertoire of the i-th singer. If there are multiple answers, print any of them.
Example
Input
4
3
12 16 14
1
1
3
1 2 3
6
81 75 75 93 93 87
Output
YES
3 1 3
YES
1
NO
YES
5 5 4 1 4 5
Note
Let's consider the 1-st test case of the example:
1. the 1-st singer in the 1-st city will give a concert for 3 minutes, in the 2-nd β for 6 minutes, in the 3-rd β for 9 minutes;
2. the 2-nd singer in the 1-st city will give a concert for 3 minutes, in the 2-nd β for 1 minute, in the 3-rd - for 2 minutes;
3. the 3-rd singer in the 1-st city will give a concert for 6 minutes, in the 2-nd β for 9 minutes, in the 3-rd β for 3 minutes. "
"You are given two positive integers x and y. You can perform the following operation with x: write it in its binary form without leading zeros, add 0 or 1 to the right of it, reverse the binary form and turn it into a decimal number which is assigned as the new value of x.
For example:
* 34 can be turned into 81 via one operation: the binary form of 34 is 100010, if you add 1, reverse it and remove leading zeros, you will get 1010001, which is the binary form of 81.
* 34 can be turned into 17 via one operation: the binary form of 34 is 100010, if you add 0, reverse it and remove leading zeros, you will get 10001, which is the binary form of 17.
* 81 can be turned into 69 via one operation: the binary form of 81 is 1010001, if you add 0, reverse it and remove leading zeros, you will get 1000101, which is the binary form of 69.
* 34 can be turned into 69 via two operations: first you turn 34 into 81 and then 81 into 69.
Your task is to find out whether x can be turned into y after a certain number of operations (possibly zero).
Input
The only line of the input contains two integers x and y (1 β€ x, y β€ 10^{18}).
Output
Print YES if you can make x equal to y and NO if you can't.
Examples
Input
3 3
Output
YES
Input
7 4
Output
NO
Input
2 8
Output
NO
Input
34 69
Output
YES
Input
8935891487501725 71487131900013807
Output
YES
Note
In the first example, you don't even need to do anything.
The fourth example is described in the statement."
"Monocarp plays a computer game (yet again!). This game has a unique trading mechanics.
To trade with a character, Monocarp has to choose one of the items he possesses and trade it for some item the other character possesses. Each item has an integer price. If Monocarp's chosen item has price x, then he can trade it for any item (exactly one item) with price not greater than x+k.
Monocarp initially has n items, the price of the i-th item he has is a_i. The character Monocarp is trading with has m items, the price of the i-th item they have is b_i. Monocarp can trade with this character as many times as he wants (possibly even zero times), each time exchanging one of his items with one of the other character's items according to the aforementioned constraints. Note that if Monocarp gets some item during an exchange, he can trade it for another item (since now the item belongs to him), and vice versa: if Monocarp trades one of his items for another item, he can get his item back by trading something for it.
You have to answer q queries. Each query consists of one integer, which is the value of k, and asks you to calculate the maximum possible total cost of items Monocarp can have after some sequence of trades, assuming that he can trade an item of cost x for an item of cost not greater than x+k during each trade. Note that the queries are independent: the trades do not actually occur, Monocarp only wants to calculate the maximum total cost he can get.
Input
The first line contains three integers n, m and q (1 β€ n, m, q β€ 2 β
10^5).
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the prices of the items Monocarp has.
The third line contains m integers b_1, b_2, ..., b_m (1 β€ b_i β€ 10^9) β the prices of the items the other character has.
The fourth line contains q integers, where the i-th integer is the value of k for the i-th query (0 β€ k β€ 10^9).
Output
For each query, print one integer β the maximum possible total cost of items Monocarp can have after some sequence of trades, given the value of k from the query.
Example
Input
3 4 5
10 30 15
12 31 14 18
0 1 2 3 4
Output
55
56
60
64
64"
"A string is called square if it is some string written twice in a row. For example, the strings ""aa"", ""abcabc"", ""abab"" and ""baabaa"" are square. But the strings ""aaa"", ""abaaab"" and ""abcdabc"" are not square.
For a given string s determine if it is square.
Input
The first line of input data contains an integer t (1 β€ t β€ 100) βthe number of test cases.
This is followed by t lines, each containing a description of one test case. The given strings consist only of lowercase Latin letters and have lengths between 1 and 100 inclusive.
Output
For each test case, output on a separate line:
* YES if the string in the corresponding test case is square,
* NO otherwise.
You can output YES and NO in any case (for example, strings yEs, yes, Yes and YES will be recognized as a positive response).
Example
Input
10
a
aa
aaa
aaaa
abab
abcabc
abacaba
xxyy
xyyx
xyxy
Output
NO
YES
NO
YES
YES
YES
NO
NO
NO
YES"
"Polycarp likes squares and cubes of positive integers. Here is the beginning of the sequence of numbers he likes: 1, 4, 8, 9, ....
For a given number n, count the number of integers from 1 to n that Polycarp likes. In other words, find the number of such x that x is a square of a positive integer number or a cube of a positive integer number (or both a square and a cube simultaneously).
Input
The first line contains an integer t (1 β€ t β€ 20) β the number of test cases.
Then t lines contain the test cases, one per line. Each of the lines contains one integer n (1 β€ n β€ 10^9).
Output
For each test case, print the answer you are looking for β the number of integers from 1 to n that Polycarp likes.
Example
Input
6
10
1
25
1000000000
999999999
500000000
Output
4
1
6
32591
32590
23125"
"Tanya is learning how to add numbers, but so far she is not doing it correctly. She is adding two numbers a and b using the following algorithm:
1. If one of the numbers is shorter than the other, Tanya adds leading zeros so that the numbers are the same length.
2. The numbers are processed from right to left (that is, from the least significant digits to the most significant).
3. In the first step, she adds the last digit of a to the last digit of b and writes their sum in the answer.
4. At each next step, she performs the same operation on each pair of digits in the same place and writes the result to the left side of the answer.
For example, the numbers a = 17236 and b = 3465 Tanya adds up as follows:
$$$ \large{ \begin{array}{r} + \begin{array}{r} 17236\\\ 03465\\\ \end{array} \\\ \hline \begin{array}{r} 1106911 \end{array} \end{array}} $$$
* calculates the sum of 6 + 5 = 11 and writes 11 in the answer.
* calculates the sum of 3 + 6 = 9 and writes the result to the left side of the answer to get 911.
* calculates the sum of 2 + 4 = 6 and writes the result to the left side of the answer to get 6911.
* calculates the sum of 7 + 3 = 10, and writes the result to the left side of the answer to get 106911.
* calculates the sum of 1 + 0 = 1 and writes the result to the left side of the answer and get 1106911.
As a result, she gets 1106911.
You are given two positive integers a and s. Find the number b such that by adding a and b as described above, Tanya will get s. Or determine that no suitable b exists.
Input
The first line of input data contains an integer t (1 β€ t β€ 10^4) β the number of test cases.
Each test case consists of a single line containing two positive integers a and s (1 β€ a < s β€ 10^{18}) separated by a space.
Output
For each test case print the answer on a separate line.
If the solution exists, print a single positive integer b. The answer must be written without leading zeros. If multiple answers exist, print any of them.
If no suitable number b exists, output -1.
Example
Input
6
17236 1106911
1 5
108 112
12345 1023412
1 11
1 20
Output
3465
4
-1
90007
10
-1
Note
The first test case is explained in the main part of the statement.
In the third test case, we cannot choose b that satisfies the problem statement."
"Vlad has n friends, for each of whom he wants to buy one gift for the New Year.
There are m shops in the city, in each of which he can buy a gift for any of his friends. If the j-th friend (1 β€ j β€ n) receives a gift bought in the shop with the number i (1 β€ i β€ m), then the friend receives p_{ij} units of joy. The rectangular table p_{ij} is given in the input.
Vlad has time to visit at most n-1 shops (where n is the number of friends). He chooses which shops he will visit and for which friends he will buy gifts in each of them.
Let the j-th friend receive a_j units of joy from Vlad's gift. Let's find the value Ξ±=min\\{a_1, a_2, ..., a_n\}. Vlad's goal is to buy gifts so that the value of Ξ± is as large as possible. In other words, Vlad wants to maximize the minimum of the joys of his friends.
For example, let m = 2, n = 2. Let the joy from the gifts that we can buy in the first shop: p_{11} = 1, p_{12}=2, in the second shop: p_{21} = 3, p_{22}=4.
Then it is enough for Vlad to go only to the second shop and buy a gift for the first friend, bringing joy 3, and for the second β bringing joy 4. In this case, the value Ξ± will be equal to min\{3, 4\} = 3
Help Vlad choose gifts for his friends so that the value of Ξ± is as high as possible. Please note that each friend must receive one gift. Vlad can visit at most n-1 shops (where n is the number of friends). In the shop, he can buy any number of gifts.
Input
The first line of the input contains an integer t (1 β€ t β€ 10^4) β the number of test cases in the input.
An empty line is written before each test case. Then there is a line containing integers m and n (2 β€ n, 2 β€ n β
m β€ 10^5) separated by a space β the number of shops and the number of friends, where n β
m is the product of n and m.
Then m lines follow, each containing n numbers. The number in the i-th row of the j-th column p_{ij} (1 β€ p_{ij} β€ 10^9) is the joy of the product intended for friend number j in shop number i.
It is guaranteed that the sum of the values n β
m over all test cases in the test does not exceed 10^5.
Output
Print t lines, each line must contain the answer to the corresponding test case β the maximum possible value of Ξ±, where Ξ± is the minimum of the joys from a gift for all of Vlad's friends.
Example
Input
5
2 2
1 2
3 4
4 3
1 3 1
3 1 1
1 2 2
1 1 3
2 3
5 3 4
2 5 1
4 2
7 9
8 1
9 6
10 8
2 4
6 5 2 1
7 9 7 2
Output
3
2
4
8
2"
"Dmitry has an array of n non-negative integers a_1, a_2, ..., a_n.
In one operation, Dmitry can choose any index j (1 β€ j β€ n) and increase the value of the element a_j by 1. He can choose the same index j multiple times.
For each i from 0 to n, determine whether Dmitry can make the MEX of the array equal to exactly i. If it is possible, then determine the minimum number of operations to do it.
The MEX of the array is equal to the minimum non-negative integer that is not in the array. For example, the MEX of the array [3, 1, 0] is equal to 2, and the array [3, 3, 1, 4] is equal to 0.
Input
The first line of input data contains a single integer t (1 β€ t β€ 10^4) β the number of test cases in the input.
The descriptions of the test cases follow.
The first line of the description of each test case contains a single integer n (1 β€ n β€ 2 β
10^5) β the length of the array a.
The second line of the description of each test case contains n integers a_1, a_2, ..., a_n (0 β€ a_i β€ n) β elements of the array a.
It is guaranteed that the sum of the values n over all test cases in the test does not exceed 2β
10^5.
Output
For each test case, output n + 1 integer β i-th number is equal to the minimum number of operations for which you can make the array MEX equal to i (0 β€ i β€ n), or -1 if this cannot be done.
Example
Input
5
3
0 1 3
7
0 1 2 3 4 3 2
4
3 0 0 0
7
4 6 2 3 5 0 5
5
4 0 1 0 4
Output
1 1 0 -1
1 1 2 2 1 0 2 6
3 0 1 4 3
1 0 -1 -1 -1 -1 -1 -1
2 1 0 2 -1 -1
Note
In the first set of example inputs, n=3:
* to get MEX=0, it is enough to perform one increment: a_1++;
* to get MEX=1, it is enough to perform one increment: a_2++;
* MEX=2 for a given array, so there is no need to perform increments;
* it is impossible to get MEX=3 by performing increments. "
"The Hat is a game of speedy explanation/guessing words (similar to Alias). It's fun. Try it! In this problem, we are talking about a variant of the game when the players are sitting at the table and everyone plays individually (i.e. not teams, but individual gamers play).
n people gathered in a room with m tables (n β₯ 2m). They want to play the Hat k times. Thus, k games will be played at each table. Each player will play in k games.
To do this, they are distributed among the tables for each game. During each game, one player plays at exactly one table. A player can play at different tables.
Players want to have the most ""fair"" schedule of games. For this reason, they are looking for a schedule (table distribution for each game) such that:
* At any table in each game there are either βn/mβ people or βn/mβ people (that is, either n/m rounded down, or n/m rounded up). Different numbers of people can play different games at the same table.
* Let's calculate for each player the value b_i β the number of times the i-th player played at a table with βn/mβ persons (n/m rounded up). Any two values of b_imust differ by no more than 1. In other words, for any two players i and j, it must be true |b_i - b_j| β€ 1.
For example, if n=5, m=2 and k=2, then at the request of the first item either two players or three players should play at each table. Consider the following schedules:
* First game: 1, 2, 3 are played at the first table, and 4, 5 at the second one. The second game: at the first table they play 5, 1, and at the second β 2, 3, 4. This schedule is not ""fair"" since b_2=2 (the second player played twice at a big table) and b_5=0 (the fifth player did not play at a big table).
* First game: 1, 2, 3 are played at the first table, and 4, 5 at the second one. The second game: at the first table they play 4, 5, 2, and at the second one β 1, 3. This schedule is ""fair"": b=[1,2,1,1,1] (any two values of b_i differ by no more than 1).
Find any ""fair"" game schedule for n people if they play on the m tables of k games.
Input
The first line of the input contains an integer t (1 β€ t β€ 10^4) β the number of test cases in the test.
Each test case consists of one line that contains three integers n, m and k (2 β€ n β€ 2β
10^5, 1 β€ m β€ βn/2β, 1 β€ k β€ 10^5) β the number of people, tables and games, respectively.
It is guaranteed that the sum of nk (n multiplied by k) over all test cases does not exceed 2β
10^5.
Output
For each test case print a required schedule β a sequence of k blocks of m lines. Each block corresponds to one game, a line in a block corresponds to one table. In each line print the number of players at the table and the indices of the players (numbers from 1 to n) who should play at this table.
If there are several required schedules, then output any of them. We can show that a valid solution always exists.
You can output additional blank lines to separate responses to different sets of inputs.
Example
Input
3
5 2 2
8 3 1
2 1 3
Output
3 1 2 3
2 4 5
3 4 5 2
2 1 3
2 6 2
3 3 5 1
3 4 7 8
2 2 1
2 2 1
2 2 1"
"Polycarp is very fond of playing the game Minesweeper. Recently he found a similar game and there are such rules.
There are mines on the field, for each the coordinates of its location are known (x_i, y_i). Each mine has a lifetime in seconds, after which it will explode. After the explosion, the mine also detonates all mines vertically and horizontally at a distance of k (two perpendicular lines). As a result, we get an explosion on the field in the form of a ""plus"" symbol ('+'). Thus, one explosion can cause new explosions, and so on.
Also, Polycarp can detonate anyone mine every second, starting from zero seconds. After that, a chain reaction of explosions also takes place. Mines explode instantly and also instantly detonate other mines according to the rules described above.
Polycarp wants to set a new record and asks you to help him calculate in what minimum number of seconds all mines can be detonated.
Input
The first line of the input contains an integer t (1 β€ t β€ 10^4) β the number of test cases in the test.
An empty line is written in front of each test suite.
Next comes a line that contains integers n and k (1 β€ n β€ 2 β
10^5, 0 β€ k β€ 10^9) β the number of mines and the distance that hit by mines during the explosion, respectively.
Then n lines follow, the i-th of which describes the x and y coordinates of the i-th mine and the time until its explosion (-10^9 β€ x, y β€ 10^9, 0 β€ timer β€ 10^9). It is guaranteed that all mines have different coordinates.
It is guaranteed that the sum of the values n over all test cases in the test does not exceed 2 β
10^5.
Output
Print t lines, each of the lines must contain the answer to the corresponding set of input data β the minimum number of seconds it takes to explode all the mines.
Example
Input
3
5 0
0 0 1
0 1 4
1 0 2
1 1 3
2 2 9
5 2
0 0 1
0 1 4
1 0 2
1 1 3
2 2 9
6 1
1 -1 3
0 -1 9
0 1 7
-1 0 1
-1 1 9
-1 -1 7
Output
2
1
0
Note
<image> Picture from examples
First example:
* 0 second: we explode a mine at the cell (2, 2), it does not detonate any other mine since k=0.
* 1 second: we explode the mine at the cell (0, 1), and the mine at the cell (0, 0) explodes itself.
* 2 second: we explode the mine at the cell (1, 1), and the mine at the cell (1, 0) explodes itself.
Second example:
* 0 second: we explode a mine at the cell (2, 2) we get:
<image>
* 1 second: the mine at coordinate (0, 0) explodes and since k=2 the explosion detonates mines at the cells (0, 1) and (1, 0), and their explosions detonate the mine at the cell (1, 1) and there are no mines left on the field. "
"You are given a permutation p of n elements. A permutation of n elements is an array of length n containing each integer from 1 to n exactly once. For example, [1, 2, 3] and [4, 3, 5, 1, 2] are permutations, but [1, 2, 4] and [4, 3, 2, 1, 2] are not permutations. You should perform q queries.
There are two types of queries:
* 1 x y β swap p_x and p_y.
* 2 i k β print the number that i will become if we assign i = p_i k times.
Input
The first line contains two integers n and q (1 β€ n, q β€ 10^5).
The second line contains n integers p_1, p_2, ..., p_n.
Each of the next q lines contains three integers. The first integer is t (1 β€ t β€ 2) β type of query. If t = 1, then the next two integers are x and y (1 β€ x, y β€ n; x β y) β first-type query. If t = 2, then the next two integers are i and k (1 β€ i, k β€ n) β second-type query.
It is guaranteed that there is at least one second-type query.
Output
For every second-type query, print one integer in a new line β answer to this query.
Examples
Input
5 4
5 3 4 2 1
2 3 1
2 1 2
1 1 3
2 1 2
Output
4
1
2
Input
5 9
2 3 5 1 4
2 3 5
2 5 5
2 5 1
2 5 3
2 5 4
1 5 4
2 5 3
2 2 5
2 5 1
Output
3
5
4
2
3
3
3
1
Note
In the first example p = \{5, 3, 4, 2, 1\}.
The first query is to print p_3. The answer is 4.
The second query is to print p_{p_1}. The answer is 1.
The third query is to swap p_1 and p_3. Now p = \{4, 3, 5, 2, 1\}.
The fourth query is to print p_{p_1}. The answer is 2."
"You had n positive integers a_1, a_2, ..., a_n arranged in a circle. For each pair of neighboring numbers (a_1 and a_2, a_2 and a_3, ..., a_{n - 1} and a_n, and a_n and a_1), you wrote down: are the numbers in the pair equal or not.
Unfortunately, you've lost a piece of paper with the array a. Moreover, you are afraid that even information about equality of neighboring elements may be inconsistent. So, you are wondering: is there any array a which is consistent with information you have about equality or non-equality of corresponding pairs?
Input
The first line contains a single integer t (1 β€ t β€ 1000) β the number of test cases. Next t cases follow.
The first and only line of each test case contains a non-empty string s consisting of characters E and/or N. The length of s is equal to the size of array n and 2 β€ n β€ 50. For each i from 1 to n:
* if s_i = E then a_i is equal to a_{i + 1} (a_n = a_1 for i = n);
* if s_i = N then a_i is not equal to a_{i + 1} (a_n β a_1 for i = n).
Output
For each test case, print YES if it's possible to choose array a that are consistent with information from s you know. Otherwise, print NO.
It can be proved, that if there exists some array a, then there exists an array a of positive integers with values less or equal to 10^9.
Example
Input
4
EEE
EN
ENNEENE
NENN
Output
YES
NO
YES
YES
Note
In the first test case, you can choose, for example, a_1 = a_2 = a_3 = 5.
In the second test case, there is no array a, since, according to s_1, a_1 is equal to a_2, but, according to s_2, a_2 is not equal to a_1.
In the third test case, you can, for example, choose array a = [20, 20, 4, 50, 50, 50, 20].
In the fourth test case, you can, for example, choose a = [1, 3, 3, 7]."
"A rectangle with its opposite corners in (0, 0) and (w, h) and sides parallel to the axes is drawn on a plane.
You are given a list of lattice points such that each point lies on a side of a rectangle but not in its corner. Also, there are at least two points on every side of a rectangle.
Your task is to choose three points in such a way that:
* exactly two of them belong to the same side of a rectangle;
* the area of a triangle formed by them is maximum possible.
Print the doubled area of this triangle. It can be shown that the doubled area of any triangle formed by lattice points is always an integer.
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of testcases.
The first line of each testcase contains two integers w and h (3 β€ w, h β€ 10^6) β the coordinates of the corner of a rectangle.
The next two lines contain the description of the points on two horizontal sides. First, an integer k (2 β€ k β€ 2 β
10^5) β the number of points. Then, k integers x_1 < x_2 < ... < x_k (0 < x_i < w) β the x coordinates of the points in the ascending order. The y coordinate for the first line is 0 and for the second line is h.
The next two lines contain the description of the points on two vertical sides. First, an integer k (2 β€ k β€ 2 β
10^5) β the number of points. Then, k integers y_1 < y_2 < ... < y_k (0 < y_i < h) β the y coordinates of the points in the ascending order. The x coordinate for the first line is 0 and for the second line is w.
The total number of points on all sides in all testcases doesn't exceed 2 β
10^5.
Output
For each testcase print a single integer β the doubled maximum area of a triangle formed by such three points that exactly two of them belong to the same side.
Example
Input
3
5 8
2 1 2
3 2 3 4
3 1 4 6
2 4 5
10 7
2 3 9
2 1 7
3 1 3 4
3 4 5 6
11 5
3 1 6 8
3 3 6 8
3 1 3 4
2 2 4
Output
25
42
35
Note
The points in the first testcase of the example:
* (1, 0), (2, 0);
* (2, 8), (3, 8), (4, 8);
* (0, 1), (0, 4), (0, 6);
* (5, 4), (5, 5).
The largest triangle is formed by points (0, 1), (0, 6) and (5, 4) β its area is 25/2. Thus, the doubled area is 25. Two points that are on the same side are: (0, 1) and (0, 6)."
"You are given an integer k and a string s that consists only of characters 'a' (a lowercase Latin letter) and '*' (an asterisk).
Each asterisk should be replaced with several (from 0 to k inclusive) lowercase Latin letters 'b'. Different asterisk can be replaced with different counts of letter 'b'.
The result of the replacement is called a BA-string.
Two strings a and b are different if they either have different lengths or there exists such a position i that a_i β b_i.
A string a is lexicographically smaller than a string b if and only if one of the following holds:
* a is a prefix of b, but a β b;
* in the first position where a and b differ, the string a has a letter that appears earlier in the alphabet than the corresponding letter in b.
Now consider all different BA-strings and find the x-th lexicographically smallest of them.
Input
The first line contains a single integer t (1 β€ t β€ 2000) β the number of testcases.
The first line of each testcase contains three integers n, k and x (1 β€ n β€ 2000; 0 β€ k β€ 2000; 1 β€ x β€ 10^{18}). n is the length of string s.
The second line of each testcase is a string s. It consists of n characters, each of them is either 'a' (a lowercase Latin letter) or '*' (an asterisk).
The sum of n over all testcases doesn't exceed 2000. For each testcase x doesn't exceed the total number of different BA-strings. String s contains at least one character 'a'.
Output
For each testcase, print a single string, consisting only of characters 'b' and 'a' (lowercase Latin letters) β the x-th lexicographically smallest BA-string.
Example
Input
3
2 4 3
a*
4 1 3
a**a
6 3 20
**a***
Output
abb
abba
babbbbbbbbb
Note
In the first testcase of the example, BA-strings ordered lexicographically are:
1. a
2. ab
3. abb
4. abbb
5. abbbb
In the second testcase of the example, BA-strings ordered lexicographically are:
1. aa
2. aba
3. abba
Note that string ""aba"" is only counted once, even though there are two ways to replace asterisks with characters 'b' to get it."
"One day, early in the morning, you decided to buy yourself a bag of chips in the nearby store. The store has chips of n different flavors. A bag of the i-th flavor costs a_i burles.
The store may run out of some flavors, so you'll decide which one to buy after arriving there. But there are two major flaws in this plan:
1. you have only coins of 1, 2 and 3 burles;
2. since it's morning, the store will ask you to pay in exact change, i. e. if you choose the i-th flavor, you'll have to pay exactly a_i burles.
Coins are heavy, so you'd like to take the least possible number of coins in total. That's why you are wondering: what is the minimum total number of coins you should take with you, so you can buy a bag of chips of any flavor in exact change?
Input
The first line contains a single integer t (1 β€ t β€ 1000) β the number of test cases.
The first line of each test case contains the single integer n (1 β€ n β€ 100) β the number of flavors in the store.
The second line of each test case contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the cost of one bag of each flavor.
Output
For each test case, print one integer β the minimum number of coins you need to buy one bag of any flavor you'll choose in exact change.
Example
Input
4
1
1337
3
10 8 10
5
1 2 3 4 5
3
7 77 777
Output
446
4
3
260
Note
In the first test case, you should, for example, take with you 445 coins of value 3 and 1 coin of value 2. So, 1337 = 445 β
3 + 1 β
2.
In the second test case, you should, for example, take 2 coins of value 3 and 2 coins of value 2. So you can pay either exactly 8 = 2 β
3 + 1 β
2 or 10 = 2 β
3 + 2 β
2.
In the third test case, it's enough to take 1 coin of value 3 and 2 coins of value 1."
"You have an array of integers (initially empty).
You have to perform q queries. Each query is of one of two types:
* ""1 x"" β add the element x to the end of the array;
* ""2 x y"" β replace all occurrences of x in the array with y.
Find the resulting array after performing all the queries.
Input
The first line contains a single integer q (1 β€ q β€ 5 β
10^5) β the number of queries.
Next q lines contain queries (one per line). Each query is of one of two types:
* ""1 x"" (1 β€ x β€ 5 β
10^5);
* ""2 x y"" (1 β€ x, y β€ 5 β
10^5).
It's guaranteed that there is at least one query of the first type.
Output
In a single line, print k integers β the resulting array after performing all the queries, where k is the number of queries of the first type.
Examples
Input
7
1 3
1 1
2 1 2
1 2
1 1
1 2
2 1 3
Output
3 2 2 3 2
Input
4
1 1
1 2
1 1
2 2 2
Output
1 2 1
Input
8
2 1 4
1 1
1 4
1 2
2 2 4
2 4 3
1 2
2 2 7
Output
1 3 3 7
Note
In the first example, the array changes as follows:
[] β [3] β [3, 1] β [3, 2] β [3, 2, 2] β [3, 2, 2, 1] β [3, 2, 2, 1, 2] β [3, 2, 2, 3, 2].
In the second example, the array changes as follows:
[] β [1] β [1, 2] β [1, 2, 1] β [1, 2, 1].
In the third example, the array changes as follows:
[] β [] β [1] β [1, 4] β [1, 4, 2] β [1, 4, 4] β [1, 3, 3] β [1, 3, 3, 2] β [1, 3, 3, 7]."
"You are given a permutation p consisting of n integers 1, 2, ..., n (a permutation is an array where each element from 1 to n occurs exactly once).
Let's call an array a bipartite if the following undirected graph is bipartite:
* the graph consists of n vertices;
* two vertices i and j are connected by an edge if i < j and a_i > a_j.
Your task is to find a bipartite array of integers a of size n, such that a_i = p_i or a_i = -p_i, or report that no such array exists. If there are multiple answers, print any of them.
Input
The first line contains a single integer t (1 β€ t β€ 2 β
10^5) β the number of test cases.
The first line of each test case contains a single integer n (1 β€ n β€ 10^6) β the size of the permutation.
The second line contains n integers p_1, p_2, ..., p_n.
The sum of n over all test cases doesn't exceed 10^6.
Output
For each test case, print the answer in the following format. If such an array a does not exist, print ""NO"" in a single line. Otherwise, print ""YES"" in the first line and n integers β array a in the second line.
Example
Input
4
3
1 2 3
6
1 3 2 6 5 4
4
4 1 3 2
8
3 2 1 6 7 8 5 4
Output
YES
1 2 3
NO
YES
-4 -1 -3 -2
YES
-3 -2 1 6 7 -8 -5 -4"
"For a sequence of strings [t_1, t_2, ..., t_m], let's define the function f([t_1, t_2, ..., t_m]) as the number of different strings (including the empty string) that are subsequences of at least one string t_i. f([]) = 0 (i. e. the number of such strings for an empty sequence is 0).
You are given a sequence of strings [s_1, s_2, ..., s_n]. Every string in this sequence consists of lowercase Latin letters and is sorted (i. e., each string begins with several (maybe zero) characters a, then several (maybe zero) characters b, ..., ends with several (maybe zero) characters z).
For each of 2^n subsequences of [s_1, s_2, ..., s_n], calculate the value of the function f modulo 998244353.
Input
The first line contains one integer n (1 β€ n β€ 23) β the number of strings.
Then n lines follow. The i-th line contains the string s_i (1 β€ |s_i| β€ 2 β
10^4), consisting of lowercase Latin letters. Each string s_i is sorted.
Output
Since printing up to 2^{23} integers would be really slow, you should do the following:
For each of the 2^n subsequences (which we denote as [s_{i_1}, s_{i_2}, ..., s_{i_k}]), calculate f([s_{i_1}, s_{i_2}, ..., s_{i_k}]), take it modulo 998244353, then multiply it by k β
(i_1 + i_2 + ... + i_k). Print the XOR of all 2^n integers you get.
The indices i_1, i_2, ..., i_k in the description of each subsequences are 1-indexed (i. e. are from 1 to n).
Examples
Input
3
a
b
c
Output
92
Input
2
aa
a
Output
21
Input
2
a
a
Output
10
Input
2
abcd
aabb
Output
124
Input
3
ddd
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaabbbbbbbbbbbcccccccccccciiiiiiiiiiiiiiiiiiiiiiooooooooooqqqqqqqqqqqqqqqqqqvvvvvzzzzzzzzzzzz
Output
15706243380"
"There are three sticks with integer lengths l_1, l_2 and l_3.
You are asked to break exactly one of them into two pieces in such a way that:
* both pieces have positive (strictly greater than 0) integer length;
* the total length of the pieces is equal to the original length of the stick;
* it's possible to construct a rectangle from the resulting four sticks such that each stick is used as exactly one of its sides.
A square is also considered a rectangle.
Determine if it's possible to do that.
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of testcases.
The only line of each testcase contains three integers l_1, l_2, l_3 (1 β€ l_i β€ 10^8) β the lengths of the sticks.
Output
For each testcase, print ""YES"" if it's possible to break one of the sticks into two pieces with positive integer length in such a way that it's possible to construct a rectangle from the resulting four sticks. Otherwise, print ""NO"".
You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES are all recognized as a positive answer).
Example
Input
4
6 1 5
2 5 2
2 4 2
5 5 4
Output
YES
NO
YES
YES
Note
In the first testcase, the first stick can be broken into parts of length 1 and 5. We can construct a rectangle with opposite sides of length 1 and 5.
In the second testcase, breaking the stick of length 2 can only result in sticks of lengths 1, 1, 2, 5, which can't be made into a rectangle. Breaking the stick of length 5 can produce results 2, 3 or 1, 4 but neither of them can't be put into a rectangle.
In the third testcase, the second stick can be broken into parts of length 2 and 2. The resulting rectangle has opposite sides 2 and 2 (which is a square).
In the fourth testcase, the third stick can be broken into parts of length 2 and 2. The resulting rectangle has opposite sides 2 and 5."
"Berland Music is a music streaming service built specifically to support Berland local artist. Its developers are currently working on a song recommendation module.
So imagine Monocarp got recommended n songs, numbered from 1 to n. The i-th song had its predicted rating equal to p_i, where 1 β€ p_i β€ n and every integer from 1 to n appears exactly once. In other words, p is a permutation.
After listening to each of them, Monocarp pressed either a like or a dislike button. Let his vote sequence be represented with a string s, such that s_i=0 means that he disliked the i-th song, and s_i=1 means that he liked it.
Now the service has to re-evaluate the song ratings in such a way that:
* the new ratings q_1, q_2, ..., q_n still form a permutation (1 β€ q_i β€ n; each integer from 1 to n appears exactly once);
* every song that Monocarp liked should have a greater rating than every song that Monocarp disliked (formally, for all i, j such that s_i=1 and s_j=0, q_i>q_j should hold).
Among all valid permutations q find the one that has the smallest value of β_{i=1}^n |p_i-q_i|, where |x| is an absolute value of x.
Print the permutation q_1, q_2, ..., q_n. If there are multiple answers, you can print any of them.
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of testcases.
The first line of each testcase contains a single integer n (1 β€ n β€ 2 β
10^5) β the number of songs.
The second line of each testcase contains n integers p_1, p_2, ..., p_n (1 β€ p_i β€ n) β the permutation of the predicted ratings.
The third line contains a single string s, consisting of n characters. Each character is either a 0 or a 1. 0 means that Monocarp disliked the song, and 1 means that he liked it.
The sum of n over all testcases doesn't exceed 2 β
10^5.
Output
For each testcase, print a permutation q β the re-evaluated ratings of the songs. If there are multiple answers such that β_{i=1}^n |p_i-q_i| is minimum possible, you can print any of them.
Example
Input
3
2
1 2
10
3
3 1 2
111
8
2 3 1 8 5 4 7 6
01110001
Output
2 1
3 1 2
1 6 5 8 3 2 4 7
Note
In the first testcase, there exists only one permutation q such that each liked song is rating higher than each disliked song: song 1 gets rating 2 and song 2 gets rating 1. β_{i=1}^n |p_i-q_i|=|1-2|+|2-1|=2.
In the second testcase, Monocarp liked all songs, so all permutations could work. The permutation with the minimum sum of absolute differences is the permutation equal to p. Its cost is 0."
"You are given an integer array a_1, a_2, ..., a_n and integer k.
In one step you can
* either choose some index i and decrease a_i by one (make a_i = a_i - 1);
* or choose two indices i and j and set a_i equal to a_j (make a_i = a_j).
What is the minimum number of steps you need to make the sum of array β_{i=1}^{n}{a_i} β€ k? (You are allowed to make values of array negative).
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of test cases.
The first line of each test case contains two integers n and k (1 β€ n β€ 2 β
10^5; 1 β€ k β€ 10^{15}) β the size of array a and upper bound on its sum.
The second line of each test case contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the array itself.
It's guaranteed that the sum of n over all test cases doesn't exceed 2 β
10^5.
Output
For each test case, print one integer β the minimum number of steps to make β_{i=1}^{n}{a_i} β€ k.
Example
Input
4
1 10
20
2 69
6 9
7 8
1 2 1 3 1 2 1
10 1
1 2 3 1 2 6 1 6 8 10
Output
10
0
2
7
Note
In the first test case, you should decrease a_1 10 times to get the sum lower or equal to k = 10.
In the second test case, the sum of array a is already less or equal to 69, so you don't need to change it.
In the third test case, you can, for example:
1. set a_4 = a_3 = 1;
2. decrease a_4 by one, and get a_4 = 0.
As a result, you'll get array [1, 2, 1, 0, 1, 2, 1] with sum less or equal to 8 in 1 + 1 = 2 steps.
In the fourth test case, you can, for example:
1. choose a_7 and decrease in by one 3 times; you'll get a_7 = -2;
2. choose 4 elements a_6, a_8, a_9 and a_{10} and them equal to a_7 = -2.
As a result, you'll get array [1, 2, 3, 1, 2, -2, -2, -2, -2, -2] with sum less or equal to 1 in 3 + 4 = 7 steps."
"You are given a binary string (i. e. a string consisting of characters 0 and/or 1) s of length n. You can perform the following operation with the string s at most once: choose a substring (a contiguous subsequence) of s having exactly k characters 1 in it, and shuffle it (reorder the characters in the substring as you wish).
Calculate the number of different strings which can be obtained from s by performing this operation at most once.
Input
The first line contains two integers n and k (2 β€ n β€ 5000; 0 β€ k β€ n).
The second line contains the string s of length n, consisting of characters 0 and/or 1.
Output
Print one integer β the number of different strings which can be obtained from s by performing the described operation at most once. Since the answer can be large, output it modulo 998244353.
Examples
Input
7 2
1100110
Output
16
Input
5 0
10010
Output
1
Input
8 1
10001000
Output
10
Input
10 8
0010011000
Output
1
Note
Some strings you can obtain in the first example:
* to obtain 0110110, you can take the substring from the 1-st character to the 4-th character, which is 1100, and reorder its characters to get 0110;
* to obtain 1111000, you can take the substring from the 3-rd character to the 7-th character, which is 00110, and reorder its characters to get 11000;
* to obtain 1100101, you can take the substring from the 5-th character to the 7-th character, which is 110, and reorder its characters to get 101.
In the second example, k = 0 so you can only choose the substrings consisting only of 0 characters. Reordering them doesn't change the string at all, so the only string you can obtain is 10010."
"Petya is a math teacher. n of his students has written a test consisting of m questions. For each student, it is known which questions he has answered correctly and which he has not.
If the student answers the j-th question correctly, he gets p_j points (otherwise, he gets 0 points). Moreover, the points for the questions are distributed in such a way that the array p is a permutation of numbers from 1 to m.
For the i-th student, Petya knows that he expects to get x_i points for the test. Petya wonders how unexpected the results could be. Petya believes that the surprise value of the results for students is equal to β_{i=1}^{n} |x_i - r_i|, where r_i is the number of points that the i-th student has got for the test.
Your task is to help Petya find such a permutation p for which the surprise value of the results is maximum possible. If there are multiple answers, print any of them.
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of test cases.
The first line of each test case contains two integers n and m (1 β€ n β€ 10; 1 β€ m β€ 10^4) β the number of students and the number of questions, respectively.
The second line contains n integers x_1, x_2, ..., x_n (0 β€ x_i β€ (m(m+1))/(2)), where x_i is the number of points that the i-th student expects to get.
This is followed by n lines, the i-th line contains the string s_i (|s_i| = m; s_{i, j} β \{0, 1\}), where s_{i, j} is 1 if the i-th student has answered the j-th question correctly, and 0 otherwise.
The sum of m for all test cases does not exceed 10^4.
Output
For each test case, print m integers β a permutation p for which the surprise value of the results is maximum possible. If there are multiple answers, print any of them.
Example
Input
3
4 3
5 1 2 2
110
100
101
100
4 4
6 2 0 10
1001
0010
0110
0101
3 6
20 3 15
010110
000101
111111
Output
3 1 2
2 3 4 1
3 1 4 5 2 6 "
"Let's call a set of positive integers a_1, a_2, ..., a_k quadratic if the product of the factorials of its elements is a square of an integer, i. e. β_{i=1}^{k} a_i! = m^2, for some integer m.
You are given a positive integer n.
Your task is to find a quadratic subset of a set 1, 2, ..., n of maximum size. If there are multiple answers, print any of them.
Input
A single line contains a single integer n (1 β€ n β€ 10^6).
Output
In the first line, print a single integer β the size of the maximum subset. In the second line, print the subset itself in an arbitrary order.
Examples
Input
1
Output
1
1
Input
4
Output
3
1 3 4
Input
7
Output
4
1 4 5 6
Input
9
Output
7
1 2 4 5 6 7 9 "
"A robot cleaner is placed on the floor of a rectangle room, surrounded by walls. The floor consists of n rows and m columns. The rows of the floor are numbered from 1 to n from top to bottom, and columns of the floor are numbered from 1 to m from left to right. The cell on the intersection of the r-th row and the c-th column is denoted as (r,c). The initial position of the robot is (r_b, c_b).
In one second, the robot moves by dr rows and dc columns, that is, after one second, the robot moves from the cell (r, c) to (r + dr, c + dc). Initially dr = 1, dc = 1. If there is a vertical wall (the left or the right walls) in the movement direction, dc is reflected before the movement, so the new value of dc is -dc. And if there is a horizontal wall (the upper or lower walls), dr is reflected before the movement, so the new value of dr is -dr.
Each second (including the moment before the robot starts moving), the robot cleans every cell lying in the same row or the same column as its position. There is only one dirty cell at (r_d, c_d). The job of the robot is to clean that dirty cell.
<image> Illustration for the first example. The blue arc is the robot. The red star is the target dirty cell. Each second the robot cleans a row and a column, denoted by yellow stripes.
Given the floor size n and m, the robot's initial position (r_b, c_b) and the dirty cell's position (r_d, c_d), find the time for the robot to do its job.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 10^4). Description of the test cases follows.
A test case consists of only one line, containing six integers n, m, r_b, c_b, r_d, and c_d (1 β€ n, m β€ 100, 1 β€ r_b, r_d β€ n, 1 β€ c_b, c_d β€ m) β the sizes of the room, the initial position of the robot and the position of the dirt cell.
Output
For each test case, print an integer β the time for the robot to clean the dirty cell. We can show that the robot always cleans the dirty cell eventually.
Example
Input
5
10 10 6 1 2 8
10 10 9 9 1 1
9 8 5 6 2 1
6 9 2 2 5 8
2 2 1 1 2 1
Output
7
10
9
3
0
Note
In the first example, the floor has the size of 10Γ 10. The initial position of the robot is (6, 1) and the position of the dirty cell is (2, 8). See the illustration of this example in the problem statement.
In the second example, the floor is the same, but the initial position of the robot is now (9, 9), and the position of the dirty cell is (1, 1). In this example, the robot went straight to the dirty cell and clean it.
<image>
In the third example, the floor has the size 9 Γ 8. The initial position of the robot is (5, 6), and the position of the dirty cell is (2, 1).
<image>
In the fourth example, the floor has the size 6 Γ 9. The initial position of the robot is (2, 2) and the position of the dirty cell is (5, 8).
<image>
In the last example, the robot was already standing in the same column as the dirty cell, so it can clean the cell right away.
<image>"
"Alice and Bob play the following game. Alice has a set S of disjoint ranges of integers, initially containing only one range [1, n]. In one turn, Alice picks a range [l, r] from the set S and asks Bob to pick a number in the range. Bob chooses a number d (l β€ d β€ r). Then Alice removes [l, r] from S and puts into the set S the range [l, d - 1] (if l β€ d - 1) and the range [d + 1, r] (if d + 1 β€ r). The game ends when the set S is empty. We can show that the number of turns in each game is exactly n.
After playing the game, Alice remembers all the ranges [l, r] she picked from the set S, but Bob does not remember any of the numbers that he picked. But Bob is smart, and he knows he can find out his numbers d from Alice's ranges, and so he asks you for help with your programming skill.
Given the list of ranges that Alice has picked ([l, r]), for each range, help Bob find the number d that Bob has picked.
We can show that there is always a unique way for Bob to choose his number for a list of valid ranges picked by Alice.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 1000). Description of the test cases follows.
The first line of each test case contains a single integer n (1 β€ n β€ 1000).
Each of the next n lines contains two integers l and r (1 β€ l β€ r β€ n), denoting the range [l, r] that Alice picked at some point.
Note that the ranges are given in no particular order.
It is guaranteed that the sum of n over all test cases does not exceed 1000, and the ranges for each test case are from a valid game.
Output
For each test case print n lines. Each line should contain three integers l, r, and d, denoting that for Alice's range [l, r] Bob picked the number d.
You can print the lines in any order. We can show that the answer is unique.
It is not required to print a new line after each test case. The new lines in the output of the example are for readability only.
Example
Input
4
1
1 1
3
1 3
2 3
2 2
6
1 1
3 5
4 4
3 6
4 5
1 6
5
1 5
1 2
4 5
2 2
4 4
Output
1 1 1
1 3 1
2 2 2
2 3 3
1 1 1
3 5 3
4 4 4
3 6 6
4 5 5
1 6 2
1 5 3
1 2 1
4 5 5
2 2 2
4 4 4
Note
In the first test case, there is only 1 range [1, 1]. There was only one range [1, 1] for Alice to pick, and there was only one number 1 for Bob to pick.
In the second test case, n = 3. Initially, the set contains only one range [1, 3].
* Alice picked the range [1, 3]. Bob picked the number 1. Then Alice put the range [2, 3] back to the set, which after this turn is the only range in the set.
* Alice picked the range [2, 3]. Bob picked the number 3. Then Alice put the range [2, 2] back to the set.
* Alice picked the range [2, 2]. Bob picked the number 2. The game ended.
In the fourth test case, the game was played with n = 5. Initially, the set contains only one range [1, 5]. The game's turn is described in the following table.
Game turn| Alice's picked range| Bob's picked number| The range set after
---|---|---|---
Before the game start| | | \{ [1, 5] \}
1| [1, 5]| 3| \{ [1, 2], [4, 5] \}
2| [1, 2]| 1| \{ [2, 2], [4, 5] \}
3| [4, 5]| 5| \{ [2, 2], [4, 4] \}
4| [2, 2]| 2| \{ [4, 4] \}
5| [4, 4]| 4| \{ \} (empty set)"
"There are n heaps of stone. The i-th heap has h_i stones. You want to change the number of stones in the heap by performing the following process once:
* You go through the heaps from the 3-rd heap to the n-th heap, in this order.
* Let i be the number of the current heap.
* You can choose a number d (0 β€ 3 β
d β€ h_i), move d stones from the i-th heap to the (i - 1)-th heap, and 2 β
d stones from the i-th heap to the (i - 2)-th heap.
* So after that h_i is decreased by 3 β
d, h_{i - 1} is increased by d, and h_{i - 2} is increased by 2 β
d.
* You can choose different or same d for different operations. Some heaps may become empty, but they still count as heaps.
What is the maximum number of stones in the smallest heap after the process?
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 2β
10^5). Description of the test cases follows.
The first line of each test case contains a single integer n (3 β€ n β€ 2 β
10^5).
The second lines of each test case contains n integers h_1, h_2, h_3, β¦, h_n (1 β€ h_i β€ 10^9).
It is guaranteed that the sum of n over all test cases does not exceed 2 β
10^5.
Output
For each test case, print the maximum number of stones that the smallest heap can contain.
Example
Input
4
4
1 2 10 100
4
100 100 100 1
5
5 1 1 1 8
6
1 2 3 4 5 6
Output
7
1
1
3
Note
In the first test case, the initial heap sizes are [1, 2, 10, 100]. We can move the stones as follows.
* move 3 stones and 6 from the 3-rd heap to the 2-nd and 1 heap respectively. The heap sizes will be [7, 5, 1, 100];
* move 6 stones and 12 stones from the last heap to the 3-rd and 2-nd heap respectively. The heap sizes will be [7, 17, 7, 82].
In the second test case, the last heap is 1, and we can not increase its size.
In the third test case, it is better not to move any stones.
In the last test case, the final achievable configuration of the heaps can be [3, 5, 3, 4, 3, 3]."
"The statement of this problem shares a lot with problem A. The differences are that in this problem, the probability is introduced, and the constraint is different.
A robot cleaner is placed on the floor of a rectangle room, surrounded by walls. The floor consists of n rows and m columns. The rows of the floor are numbered from 1 to n from top to bottom, and columns of the floor are numbered from 1 to m from left to right. The cell on the intersection of the r-th row and the c-th column is denoted as (r,c). The initial position of the robot is (r_b, c_b).
In one second, the robot moves by dr rows and dc columns, that is, after one second, the robot moves from the cell (r, c) to (r + dr, c + dc). Initially dr = 1, dc = 1. If there is a vertical wall (the left or the right walls) in the movement direction, dc is reflected before the movement, so the new value of dc is -dc. And if there is a horizontal wall (the upper or lower walls), dr is reflected before the movement, so the new value of dr is -dr.
Each second (including the moment before the robot starts moving), the robot cleans every cell lying in the same row or the same column as its position. There is only one dirty cell at (r_d, c_d). The job of the robot is to clean that dirty cell.
After a lot of testings in problem A, the robot is now broken. It cleans the floor as described above, but at each second the cleaning operation is performed with probability \frac p {100} only, and not performed with probability 1 - \frac p {100}. The cleaning or not cleaning outcomes are independent each second.
Given the floor size n and m, the robot's initial position (r_b, c_b) and the dirty cell's position (r_d, c_d), find the expected time for the robot to do its job.
It can be shown that the answer can be expressed as an irreducible fraction \frac x y, where x and y are integers and y not β‘ 0 \pmod{10^9 + 7} . Output the integer equal to x β
y^{-1} mod (10^9 + 7). In other words, output such an integer a that 0 β€ a < 10^9 + 7 and a β
y β‘ x \pmod {10^9 + 7}.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 β€ t β€ 10). Description of the test cases follows.
A test case consists of only one line, containing n, m, r_b, c_b, r_d, c_d, and p (4 β€ n β
m β€ 10^5, n, m β₯ 2, 1 β€ r_b, r_d β€ n, 1 β€ c_b, c_d β€ m, 1 β€ p β€ 99) β the sizes of the room, the initial position of the robot, the position of the dirt cell and the probability of cleaning in percentage.
Output
For each test case, print a single integer β the expected time for the robot to clean the dirty cell, modulo 10^9 + 7.
Example
Input
6
2 2 1 1 2 1 25
3 3 1 2 2 2 25
10 10 1 1 10 10 75
10 10 10 10 1 1 75
5 5 1 3 2 2 10
97 98 3 5 41 43 50
Output
3
3
15
15
332103349
99224487
Note
In the first test case, the robot has the opportunity to clean the dirty cell every second. Using the [geometric distribution](https://en.wikipedia.org/wiki/Geometric_distribution), we can find out that with the success rate of 25\%, the expected number of tries to clear the dirty cell is \frac 1 {0.25} = 4. But because the first moment the robot has the opportunity to clean the cell is before the robot starts moving, the answer is 3.
<image> Illustration for the first example. The blue arc is the robot. The red star is the target dirt cell. The purple square is the initial position of the robot. Each second the robot has an opportunity to clean a row and a column, denoted by yellow stripes.
In the second test case, the board size and the position are different, but the robot still has the opportunity to clean the dirty cell every second, and it has the same probability of cleaning. Therefore the answer is the same as in the first example.
<image> Illustration for the second example.
The third and the fourth case are almost the same. The only difference is that the position of the dirty cell and the robot are swapped. But the movements in both cases are identical, hence the same result."
"A binary tree of n nodes is given. Nodes of the tree are numbered from 1 to n and the root is the node 1. Each node can have no child, only one left child, only one right child, or both children. For convenience, let's denote l_u and r_u as the left and the right child of the node u respectively, l_u = 0 if u does not have the left child, and r_u = 0 if the node u does not have the right child.
Each node has a string label, initially is a single character c_u. Let's define the string representation of the binary tree as the concatenation of the labels of the nodes in the in-order. Formally, let f(u) be the string representation of the tree rooted at the node u. f(u) is defined as follows: $$$ f(u) = \begin{cases} <empty string>, & if u = 0; \\\ f(l_u) + c_u + f(r_u) & otherwise, \end{cases} where +$$$ denotes the string concatenation operation.
This way, the string representation of the tree is f(1).
For each node, we can duplicate its label at most once, that is, assign c_u with c_u + c_u, but only if u is the root of the tree, or if its parent also has its label duplicated.
You are given the tree and an integer k. What is the lexicographically smallest string representation of the tree, if we can duplicate labels of at most k nodes?
A string a is lexicographically smaller than a string b if and only if one of the following holds:
* a is a prefix of b, but a β b;
* in the first position where a and b differ, the string a has a letter that appears earlier in the alphabet than the corresponding letter in b.
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 2 β
10^5).
The second line contains a string c of n lower-case English letters, where c_i is the initial label of the node i for 1 β€ i β€ n. Note that the given string c is not the initial string representation of the tree.
The i-th of the next n lines contains two integers l_i and r_i (0 β€ l_i, r_i β€ n). If the node i does not have the left child, l_i = 0, and if the node i does not have the right child, r_i = 0.
It is guaranteed that the given input forms a binary tree, rooted at 1.
Output
Print a single line, containing the lexicographically smallest string representation of the tree if at most k nodes have their labels duplicated.
Examples
Input
4 3
abab
2 3
0 0
0 4
0 0
Output
baaaab
Input
8 2
kadracyn
2 5
3 4
0 0
0 0
6 8
0 7
0 0
0 0
Output
daarkkcyan
Input
8 3
kdaracyn
2 5
0 3
0 4
0 0
6 8
0 7
0 0
0 0
Output
darkcyan
Note
The images below present the tree for the examples. The number in each node is the node number, while the subscripted letter is its label. To the right is the string representation of the tree, with each letter having the same color as the corresponding node.
Here is the tree for the first example. Here we duplicated the labels of nodes 1 and 3. We should not duplicate the label of node 2 because it would give us the string ""bbaaab"", which is lexicographically greater than ""baaaab"".
<image>
In the second example, we can duplicate the labels of nodes 1 and 2. Note that only duplicating the label of the root will produce a worse result than the initial string.
<image>
In the third example, we should not duplicate any character at all. Even though we would want to duplicate the label of the node 3, by duplicating it we must also duplicate the label of the node 2, which produces a worse result.
<image>
There is no way to produce string ""darkkcyan"" from a tree with the initial string representation ""darkcyan"" :(."
|