#P15731. [JAG 2024 Summer Camp #2] Convenient Banknotes

[JAG 2024 Summer Camp #2] Convenient Banknotes

题目描述

In the Kingdom of JAG, only 11-yen banknotes have been issued so far. However, due to the increase in the circulation of banknotes, the kingdom has decided to renew its banknote system entirely. The new banknote system is represented by a sequence of positive integers X=(X1,X2,,Xk)X = (X_1, X_2, \ldots, X_k). This means that the new system uses kk types of banknotes with denominations of X1,X2,,XkX_1, X_2, \ldots, X_k yen. You can decide the number of banknote types kk and their values X1,X2,,XkX_1, X_2, \ldots, X_k under the following restrictions:

  • kk is a positive integer.
  • 1=X1<X2<<Xk1 = X_1 < X_2 < \cdots < X_k.
  • Xi+1X_{i+1} must be a multiple of XiX_i (1ik11 \leq i \leq k-1).

In the Kingdom of JAG, goods are often traded at prices of AA, BB, or CC yen. Therefore, the inconvenience of the new banknote system is defined as:

(The minimum number of banknotes required to represent AA yen) + (The minimum number of banknotes required to represent BB yen) + (The minimum number of banknotes required to represent CC yen).

Your task is to find the minimum possible value of this inconvenience.

输入格式

The input is given in the following format:

A B CA \ B \ C
  • 1A<B<C1081 \leq A < B < C \leq 10^8
  • All input values are integers.

输出格式

Output a single line with the minimum possible value of the inconvenience for the new banknote system.

6 11 15
6
99999959 99999971 99999989
11