There is given two numbers n and m (1 ≤ n, m ≤ 10^8);
1) Divide n from 2 until 1.
2) Multiply m from 2 as many times as n was divided.
3) We are getting a table:
e.g. n=69, m=26;
69 26
34 52
17 104
8 208
4 416
2 832
1 1664
4) Delete these rows which numbers in left side are even.
e.g.
69 26
17 104
1 1664
5) Sum these elements which are in right column.
e.g.
26+104+1664=1794