Competitors’ quantity of olimpia
How we know for question how many pupils he has Greek scientist Pifagor answer: “One half of my pupils learn math, the fourth parts learns nature, the seventh part spend time in thinking, the last part is three girls”. For question “How many competitors’ quantity of olimpiad from computer science registered?”. The secretary of olimpiad answer like Pifagor: "K part of boys start solves first problem, M part – start solves sec-ond problem and N part – start solves third problem. In that time D competitors’ decide a problem: "How to start?". Your task is find the competitors’ quantity of olimpiad S, or write -1, if secretary wrongs in his message.
Input In a single line through the gap in the number of K, N, M, D. 1 ≤ K, N, M, D ≤ 1000. Output Output the number of participants Olympiad S, or -1 if the Secretary was mistaken in his report.