Choosing subjects

Pick the three highest scores among the four science subjects and the higher of history and geography, then print their sum.

Easy1GreedySortingNo attempts yetTime limit2sMemory limit512 MB

Problem

JOI sat exams in six subjects: physics, chemistry, biology, earth science, history and geography. Each exam is worth at most 100 points.

JOI picks three subjects out of physics, chemistry, biology and earth science, and one subject out of history and geography.

Find the total score of the picked subjects when the picks are made so that the total is as large as possible.

Input

The input has six lines, each holding one integer.

The first line holds the physics score AA.

The second line holds the chemistry score BB.

The third line holds the biology score CC.

The fourth line holds the earth science score DD.

The fifth line holds the history score EE.

The sixth line holds the geography score FF.

Every one of AA, BB, CC, DD, EE and FF is an integer between 00 and 100100, inclusive.

Output

Print the total score of the four subjects JOI picked on one line.

Hint

In the first example the total is largest when JOI picks physics, biology, earth science and history. Those four scores are 100, 76, 42 and 10, so the total is 228.

In the second example the total is largest when JOI picks chemistry, biology, earth science and geography. Those four scores are 21, 15, 42 and 62, so the total is 140.