Lilavati#2062

Lilavati

0.5 seconds
64 megabytes
Hard

The greatest mathematician of XII century India, Bhaskara, is the author of the treatise "Siddhanta-Shiromani" ("Teachings of the crown"), rewritten in the XIII century on strips of palm leaves. This treatise consists of four parts, of which "Lilavati" is devoted to arithmetic, "Bidzhaganita" to algebra, and the other two parts to astronomy. "Lilavati" (which means "beautiful") Bhaskara devoted to his daughter.

Many of Bhaskara's puzzles were expounded in poetic form. Here is one:

From the set of pure lotusThe third part has been brought as a gift to Shiva,The fifth part to Vishnu, the sixth to the Sun;The fourth part of all flowers received Bhvani,The remaining six flowers were given to the highly esteemed Teacher.

We cannot literally convey the charm and beauty of the sound of these ancient Indian poems, so our puzzle is formulated in prose. The general form of the problem is as follows: "The gift for Lord Shiva is the -th part of lotus flowers, a gift for Lord Vishnu is the -th part, for the Sun — the -th part, Bhvani receives the -th part, and the highly esteemed Teacher receives flowers. How many lotus flowers were originally available?"

Input

The first and only line of the input contains integers: , , , , and , each not exceeding .

Output

Output a single number — the answer to the problem, or if the input data are inconsistent or if the puzzle cannot possibly be solved.

Examples

Example 1

Loading
Loading