#Lutece1419. 条头日今の面试(一)

条头日今の面试(一)

Migrated from Lutece 1419 条头日今の面试(一)

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

省府弟子乐天潭在条头日今的笔试中遇到了四道题,其中第一题是:

已知 nntt,构造一棵 nn 个节点的树,使得边权和最大。

节点的编号为 11nn,对于 uuvv 之间的无向边,边权 w(u,v)=gcd(u,v) and tw(u,v) = \gcd(u,v) \text{ and }t。其中 a and ba\text{ and }b 表示 aabb 的按位与。

乐天潭很强势,一眼就知道了解法,但计算量实在过大,没办法只好偷偷掏出手机请你帮他写一个程序算出答案。

Input

第一行,两个整数 nn (1n30001 \le n \le 3000),tt (1t109+71 \le t \le 10^9+7)。

Output

输出一行,一个整数,表示答案。

Samples

3 3
2

Note

样例有三种构造方法:

方法一:将 11222233 连边,$\gcd(1,2)\text{ and }3 + \gcd(2,3)\text{ and }3 = 2$

方法二:将 11221133 连边,$\gcd(1,2)\text{ and }3 + \gcd(1,3)\text{ and }3 = 2$

方法三:将 11332233 连边,$\gcd(1,3)\text{ and }3 + \gcd(2,3)\text{ and }3 = 2$

Resources

2016 UESTC Training for Graph Theory