B - Addition and Multiplication Editorial /

Time Limit: 2 sec / Memory Limit: 256 MB

配点:200

問題文

square1001 は、電光掲示板に整数 1 が表示されているのを見ました。
彼は、電光掲示板に対して、以下の操作 A, 操作 B をすることができます。

  • 操作 A: 電光掲示板に表示する整数を「今の電光掲示板の整数を 2 倍にしたもの」に変える。
  • 操作 B: 電光掲示板に表示する整数を「今の電光掲示板の整数に K を足したもの」に変える。

square1001 は、操作 A, 操作 B 合計で N 回 行わなければなりません。 そのとき、N 回の操作後の、電光掲示板に書かれている整数として考えられる最小の値を求めなさい。

制約

  • 1 \leq N, K \leq 10
  • 入力はすべて整数である

入力

入力は以下の形式で標準入力から与えられる。

N
K

出力

square1001 が N 回操作を行った後の、電光掲示板に書かれている整数として考えられる最小値を出力しなさい。


入力例 1

4
3

出力例 1

10

高橋君は、操作 A, A, B, B の順でやると、整数を最小化できます。 この時、電光掲示板に書かれている整数は 124710 と変わり、最終的に 10 となります。


入力例 2

10
10

出力例 2

76

高橋君は、操作 A, A, A, A, B, B, B, B, B, B の順にやると、整数を最小化できます。 この時、電光掲示板に書かれている整数は 124816263646566676 と変わり、最終的に 76 となります。

なお、今日のコンテストは、AtCoder Beginner Contest 076 です。

Score : 200 points

Problem Statement

Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value:

  • Operation A: The displayed value is doubled.
  • Operation B: The displayed value increases by K.

Square1001 needs to perform these operations N times in total. Find the minimum possible value displayed in the board after N operations.

Constraints

  • 1 \leq N, K \leq 10
  • All input values are integers.

Input

Input is given from Standard Input in the following format:

N
K

Output

Print the minimum possible value displayed in the board after N operations.


Sample Input 1

4
3

Sample Output 1

10

The value will be minimized when the operations are performed in the following order: A, A, B, B.
In this case, the value will change as follows: 124710.


Sample Input 2

10
10

Sample Output 2

76

The value will be minimized when the operations are performed in the following order: A, A, A, A, B, B, B, B, B, B.
In this case, the value will change as follows: 124816263646566676.

By the way, this contest is AtCoder Beginner Contest 076.