QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 128 MB 満点: 100 ハック可能 ✓

#15862. Moon Forest

統計

One morning, a little girl playing in the forest saw a magical seed that was radiating light and emitting a faint, pleasant fragrance. The girl loved the seed, so she held it in her hands and brought it home.

That night, the girl had a dream in which she saw a kind-looking old man with a white beard. The old man told her that the seed in her hand came from a Moon Tree, which originally could only be found on the moon. By a stroke of fate, the seed had fallen to Earth and could no longer return to the moon. The old man, noticing how much the girl loved the seed, asked if she would be willing to use her diligence and wisdom to grow a lush Moon Forest from this tiny seed, giving the Moon Tree a warm new home on Earth. The girl nodded excitedly and eagerly asked the old man what she should do.

The old man explained that this seed is extraordinary. The morning after it is planted, it will grow into a small sapling with a height of 1 unit. The Moon Tree is extremely resilient; thereafter, it will grow 1 unit taller every morning. Since the Moon Tree is different from Earth's organisms, the girl must use a special fertilizer to nourish it, and the old man will provide her with 1 unit of this fertilizer every day. Every evening, she must fertilize one tree or a seed that was planted that afternoon; she cannot fertilize more than one, nor can she skip fertilizing. A tree or seed that is fertilized will grow 2 units taller the next morning instead of the usual 1 unit. During the growth process of a Moon Tree, there are two special heights called "harvest points," denoted as $HP_1$ and $HP_2$. At noon on the day the Moon Tree's height first reaches or exceeds $HP_1$, the tree will bear a fruit. Similarly, at noon on the day the height first reaches or exceeds $HP_2$, the tree will bear another fruit. Each fruit contains a seed exactly like the one the girl originally found. Every afternoon, the girl can choose to plant some seeds, or she can choose not to plant any. Only when the girl has planted exactly $M$ trees and they all have the same height can these trees truly adapt to the Earth's environment and live forever.

The afternoon after she woke up, the girl planted the seed as the old man had instructed. She made the task entrusted to her by the old man her life's greatest wish, working diligently day after day, year after year. Every evening, as she sat on the threshold looking into the distance, a beautiful and vast Moon Forest would appear before her eyes. She firmly believed that she would succeed, and she was not afraid of how long it would take. But when will that day finally arrive?

Input

The input contains three integers $HP_1, HP_2, M$ ($2 \le HP_1 < HP_2 \le 20$, $2 \le M \le 100$), representing the two harvest point heights and the required number of Moon Trees.

Output

The output contains a single integer $T$, the minimum number of days required.

Examples

Input 1

4 9 3

Output 1

12

Input 2

10 15 6

Output 2

84

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.