問題一覧 > 通常問題

No.268 Wrapping (Easy)

レベル : / AI推定難易度 : 159 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 295
作問者 : 👑 kmjp
お気に入りにしたユーザー ProblemId : 394 / 自分の提出
問題文最終更新日: 2026-06-25 02:58:47
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 118 (順位表) の他の問題:

Problem Statement

yuki has decided to wrap a box containing a present for his friend with ribbons.
Since the present is very heavy, he plans to wind the ribbons around the box many times just to be safe.

yuki wraps the rectangular cuboid box as follows.
- The red ribbon is wound \(R\) times around the four faces of the cuboid: top, back, bottom, and front.
- The blue ribbon is wound \(B\) times around the four faces of the cuboid: top, left, bottom, and right.
- The yellow ribbon is wound \(Y\) times around the four faces of the cuboid: front, right, back, and left.

Each ribbon is wound so that it passes through the midpoints of the edges of the cuboid and has no slack. The ribbons are extremely thin, so their thickness may be ignored.
The figure below shows an example of the wrapping.


The orientation of the box can be rotated freely.
Given the lengths of the three edges of the box and the number of times to wind each ribbon, find the minimum total length of the ribbons of the three colors required for the wrapping.

Input

\(L_1, L_2, L_3\)
\(R\) \(B\) \(Y\)

\(L_1, L_2, L_3\) are integers representing the lengths of the three edges of the present box, and satisfy \(1\le L_1, L_2, L_3 \le 100\).
\(R, B, Y\) are integers representing the numbers of times to wind the ribbons as described in the problem statement, and satisfy \(0\le R, B, Y \le 100\).

Output

Output the minimum total length of the required ribbons on one line.

Sample

Sample 1
Input
3 4 5
1 1 2
Output
62

It is best to bring the 4*5 face to the front.

Sample 2
Input
10 10 10
5 0 3
Output
320

Not all three colors of ribbon are necessarily used.

Sample 3
Input
56 34 12
7 8 9
Output
3176

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