You are given four integers ,
,
,
that satisfy the equations
and
, where
is a positive integer. Output all possible values of
. It is possible that there are none — in which case you do not need to output anything.
Constraints
For all subtasks:
and
Points Awarded | Additional Constraints |
---|---|
3 points | |
5 points | |
7 points | No further constraints |
Input Specification
The only line of input contains four integers ,
,
and
.
Output Specification
Output all possible values of , each on their own line and in ascending order.
Sample Input
13 1 10 2
Sample Output
4
Explanation for Sample
and
. It can be shown that this is the only possible value of
.
Comments