QOJ.ac

QOJ

时间限制: 1 s 内存限制: 1024 MB 总分: 100 可 Hack ✓

#18111. The Reason Why Hobanwoo Was Late for School 1

统计

Hobanwoo, the mascot and thumbs-up fairy of Kyungpook National University, was on his way to class passing through the main gate of the university when he was swept into a mysterious portal and ended up in another world.

As the god of this other world, you must help Hobanwoo defeat the Demon King and return to Earth so he is not late for school!

You are given four numbers representing Hobanwoo's current stats: Strength ($STR$), Dexterity ($DEX$), Intelligence ($INT$), and Luck ($LUK$).

Find the minimum number of blessings required to make Hobanwoo's average stat value at least $N$, where each blessing increases one of the four stats by $1$.

Input

The first line contains $STR$, $DEX$, $INT$, $LUK$, and $N$, separated by spaces. $(1 \le STR,\,DEX,\,INT,\,LUK,\,N \le 100)$

All input numbers are positive integers.

Output

Output the minimum number of blessings required to make Hobanwoo's average stat value at least $N$.

Examples

Input 1

100 100 100 100 1

Output 1

0

Input 2

100 1 100 1 100

Output 2

198

Input 3

1 1 1 1 1

Output 3

0

Input 4

100 100 100 100 100

Output 4

0

Input 5

99 100 99 100 99

Output 5

0

Input 6

1 1 1 1 100

Output 6

396

Input 7

1 100 1 100 1

Output 7

0

Note

Hobanwoo's average stat value can be calculated as follows:

$$ \begin{aligned} \frac{STR+DEX+INT+LUK}{4} \end{aligned} $$

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.