CF869D The Overdosing Ubiquity

Description

The fundamental prerequisite for justice is not to be correct, but to be strong. That's why justice is always the victor. The Cinderswarm Bee. Koyomi knows it. The bees, according to their nature, live in a tree. To be more specific, a complete binary tree with $ n $ nodes numbered from $ 1 $ to $ n $ . The node numbered $ 1 $ is the root, and the parent of the $ i $ -th ( $ 2

Input Format

The first line of input contains two space-separated integers $ n $ and $ m $ ( $ 1

Output Format

Output one integer — the number of simple paths in the resulting graph, modulo $ 10^{9}+7 $ .

Explanation/Hint

In the first example, the paths are: $ (1) $ ; $ (2) $ ; $ (3) $ ; $ (1,2) $ ; $ (2,1) $ ; $ (1,3) $ ; $ (3,1) $ ; $ (2,1,3) $ ; $ (3,1,2) $ . (For the sake of clarity, the edges between nodes are omitted since there are no multiple edges in this case.) In the second example, the paths are: $ (1) $ ; $ (1,2) $ ; $ (1,2,3) $ ; $ (1,3) $ ; $ (1,3,2) $ ; and similarly for paths starting with $ 2 $ and $ 3 $ . ( $ 5×3=15 $ paths in total.) In the third example, the paths are: $ (1) $ ; $ (2) $ ; any undirected edge connecting the two nodes travelled in either direction. ( $ 2+5×2=12 $ paths in total.)