Fakir
Time limit1sMemory limit1024 MB
Given the counts of gray, white, black, and spotted mice, find the fewest draws that guarantee at least one mouse of each color.
- Level
Easy2 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
Fakir Miki has a gray mice, b white mice, c black mice, and d spotted mice in his magic hat. He keeps his eyes closed while drawing mice from the hat. What is the minimum number of mice the fakir must draw to be certain that the drawn mice include at least one mouse of each color?
Write a program named fakir that prints this number.
Input
The only line of standard input contains the integers , , , and .
Output
Print the minimum number of mice the fakir must draw from the magic hat.
Constraints