Unknown Number

Time limit2sMemory limit128 MB

Summary
Given an interval's two endpoints and a divisor-remainder pair, determine whether exactly one integer in that range satisfies the modular condition and print it, or report the number as unknown.
Level

Medium4 of 10

Topics
Math, Implementation, Number theory
Solved
No attempts yet

Problem

You must determine one integer.

You are given the following two pieces of information.

  1. The two endpoints of the integer interval where the number may lie
  2. The remainder y when the number is divided by the integer x; equivalently, the number can be written as qx + y for some integer q, with 0 <= y < |x|

If exactly one integer is possible from this information, output that integer. Otherwise, output that the number is unknown.

Input

The first line contains the two endpoints of the interval where the integer may lie.

The second line contains the divisor x and the remainder y.

Every number in the input is an integer between -2^31 and 2^31 - 1, inclusive.

Output

If the possible integer can be determined uniquely, output that integer. If it cannot be determined uniquely, output Unknwon Number.

Examples2

  1. Example 1

    Input
    1 10
    10 5
    
    Expected output
    5
    
  2. Example 2

    Input
    1 10
    7 2
    
    Expected output
    Unknwon Number