Hide

Problem E
Polypleating

Languages en is
/problems/margfoldun/file/statement/en/img-0001.png
Image from pxhere.com

Gunnar works at a laundromat where he and his co-workers get really bored at work. In order to entertain themselves they decide to compete in towel folding, a competition where the victor is determined by who has the thickest towel. Unfortunately, they do not have any measuring tools. To make the competition as objective and fair as possible they require a program that will act as a judge. The purpose of the judge is to determine the thickness of a towel after being folded. You may assume that towels are $1\text{mm}$ thick originally.

Input

Input consists of two lines. The first line contains one integer $n$, how many layers the towel is folded in to on the long side. The second line contains one integer $m$, how many layers the towel is folded in to on the short side.

Output

The new height after folding it together.

Scoring

Groups

Points

Constraints

1

100

$0 \leq m \leq n \leq 10\, 000$

Explanation of samples

In the first sample, the towel is folded into $4$ layers on the long side and $3$ layers on the short side.

\includegraphics[width=0.7\textwidth ]{towel_1}
Figure 1: Initially, the thickness is $1$.
\includegraphics[width=0.7\textwidth ]{towel_2}
Figure 2: After folding once the thickness is $2$.
\includegraphics[width=0.7\textwidth ]{towel_3}
Figure 3: After folding twice the thickness is $3$.
\includegraphics[width=0.7\textwidth ]{towel_4}
Figure 4: After folding three times the thickness is $4$.
\includegraphics[width=0.7\textwidth ]{towel_5}
Figure 5: After folding four times the thickness is $8$.
\includegraphics[width=0.7\textwidth ]{towel_6}
Figure 6: After folding five times the thickness is $12$.
Sample Input 1 Sample Output 1
4
3
12
Sample Input 2 Sample Output 2
6
7
42
Sample Input 3 Sample Output 3
1
1
1

Please log in to submit a solution to this problem

Log in