Why Hoban-woo Was Late for School 1
InterviewTime limit1sMemory limit1024 MB
Given four stats and a target N, find the fewest +1 blessings needed so the average of the four stats is at least N.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Hoban-woo, the mascot of Kyungpook National University and a thumbs-up fairy, was heading through the university's main gate on the way to class when a mysterious dimensional gate pulled him into another world.
As a god of this other world, you will help Hoban-woo defeat the Demon King, return to Earth, and get to school on time.
You are given four numbers, which are Hoban-woo's current stats: strength (), dexterity (), intelligence (), and luck ().
Using blessings that each raise one stat by 1, find the minimum number of blessings needed to make Hoban-woo's average stat at least .
Input
The first line contains , , , , and separated by spaces.
All input numbers are positive integers.
Output
Print the minimum number of blessings needed to make Hoban-woo's average stat at least .
Hint
Hoban-woo's average stat can be computed as follows.
Average stat