Codeforces Round 262 (Div. 2)
A
Vasya and Socks
Codeforces
900
原题
←B →
翻译中…

Vasya has $*n*$ pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When he comes home in the evening, Vasya takes off the used socks and throws them away. Every $*m*$-th day (at days with numbers $*m*, 2*m*, 3*m*, ...$) mom buys a pair of socks to Vasya. She does it late in the evening, so that Vasya cannot put on a new pair of socks before the next day. How many consecutive days pass until Vasya runs out of socks?

翻译中…

Input

翻译中…

The single line contains two integers $*n*$ and $*m*$ $(1 ≤ *n* ≤ 100; 2 ≤ *m* ≤ 100)$, separated by a space.

翻译中…

Output

翻译中…

Print a single integer — the answer to the problem.

翻译中…

Note

翻译中…

In the first sample Vasya spends the first two days wearing the socks that he had initially. Then on day three he puts on the socks that were bought on day two.

翻译中…

In the second sample Vasya spends the first nine days wearing the socks that he had initially. Then he spends three days wearing the socks that were bought on the third, sixth and ninth days. Than he spends another day wearing the socks that were bought on the twelfth day.

翻译中…

样例

Input #1
2 2
Output #1
3
InputCopy OutputCopy
Input #2
9 3
Output #2
13
InputCopy OutputCopy
题目信息
题号
460A
时间限制
1 s
内存限制
256 MB
标签
暴力
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。