問題一覧 > 通常問題

No.2386 Udon Coupon (Easy)

レベル : / AI推定難易度 : 400 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 214
作問者 : GlinTFraulein / テスター : cleantted tatyam PCTprobability Mizar 👑 amentorimaru
お気に入りにしたユーザー ProblemId : 9504 / 自分の提出
問題文最終更新日: 2023-07-20 05:11:41
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 398 (順位表) の他の問題:

Problem Statement

At a certain udon restaurant, you can receive discounts by using some "udon coupons".

There are the following $3$ types of discounts.

  • Use $3$ "udon coupons" to receive a discount of $A$ yen
  • Use $5$ "udon coupons" to receive a discount of $B$ yen
  • Use $10$ "udon coupons" to receive a discount of $C$ yen

These discounts can be received any number of times as long as you have "udon coupons", but the "udon coupons" used are consumed.

Now, Midori wants to use her "udon coupons" to receive as large a discount as possible. Given that she has $N$ "udon coupons", output the maximum total discount amount $D$.

Constraints

  • $1 \le N \le 2 \times 10^5$
  • $1 \le A \lt B \lt C \le 1000$
  • All inputs are integers

Input

$N$
$A$ $B$ $C$

Output

$D$

Output the maximum total discount amount $D$.

Sample

Sample 1
Input
16
90 100 390
Output
570

  • Use $3$ "udon coupons" to receive a discount of $90$ yen.
  • Use $3$ "udon coupons" to receive a discount of $90$ yen once more.
  • Use $10$ "udon coupons" to receive a discount of $390$ yen.

The total discount is $570$ yen. No larger discount can be achieved.

Sample 2
Input
2
800 900 1000
Output
0

There may be cases where not all "udon coupons" can be consumed, or where not even $1$ can be used.

Sample 3
Input
314
159 265 358
Output
16642

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。