logo AlgoBeat OnlineJudge
登录 注册

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

内存限制:1024 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

In the Kingdom of JAG, only -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 . This means that the new system uses types of banknotes with denominations of yen. You can decide the number of banknote types and their values under the following restrictions:

  • is a positive integer.
  • .
  • must be a multiple of ().

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

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

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

输入格式

The input is given in the following format:

  • All input values are integers.

输出格式

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

样例

样例输入 1

6 11 15

样例输出 1

6

样例输入 2

99999959 99999971 99999989

样例输出 2

11