Under construction

Still being built. Things may change

Fakir

Time limit1sMemory limit1024 MB

Summary
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 aa, bb, cc, and dd.

Output

Print the minimum number of mice the fakir must draw from the magic hat.

Constraints

0<a<5000 < a < 500

0<b<5000 < b < 500

0<c<5000 < c < 500

0<d<5000 < d < 500

Examples1

  1. Example 1

    Input
    14 9 4 7
    
    Expected output
    31