Try our new interface for solving problems

Young Programmers

Young Programmers

prb2061It is known that the school not less than k1 students, but not more than k2 учеников. students. Also know that every boy be friends n girls, each girl with m boys. What is the minimum number of students can be in school and how school boys and girls?

Young programmers, as you can see, still solve this puzzle. Help them.


The first line of the input file is 4 numbers separated by spaces: k1, k2, n and m. All input data are natural numbers not exceeding 10000, k1 ≤ k2.


In a single line display through gap three numbers: first, the number of pupils at school, then the number of boys and then girls. Guaranteed that the input data is correct and the answer is always there.

Time limit 1 second
Memory limit 64 MiB
Input example #1
20 30 4 5
Output example #1
27 15 12
Author Анатолий Присяжнюк
Source Open and Distance Olympiads 2011-2012