Woburn Challenge 2017-18 Round 2 - Junior Division

Rings for the Elven-kings under the sky,
for the Dwarf-lords in their halls of stone,
for Mortal Men doomed to die,
One for the Dark Lord on his dark throne,
In the Land of Mordor where the Shadows lie,
One ring to rule them all, one ring to find them,
One ring to bring them all and in the darkness bind them,
In the Land of Mordor where the Shadows lie.
As the above passage indicates, a number of Rings of Power exist in
Middle-earth, with exactly one of them owned by the Dark Lord Sauron,
and the others distributed amongst Elves, Dwarves, and Men according to
the values ,
, and
. Your task is to
determine the total number of Rings of Power which have been forged
(that is, the number of rings held by Elves, Dwarves, Men, and Sauron
combined).
Input Specification
The first and only line of input consists of three space-separated
integers, ,
, and
.
Output Specification
Output a single integer, the total number of Rings of Power.
Sample Input
3 7 9
Sample Output
20
Sample Explanation
Elves have Rings, Dwarves have
, Men have
, and Sauron himself has
, for a total of
.
Comments