RoAlgo Contest #10 | martin

This was the problem page during the contest. Access the current page here.
Time limit: 0.05s Memory limit: 1MB Input: Output:

Martin.

Martin chooses two natural numbers aa and bb. He also chooses a number kk and calculates the numbers xx and yy, which represent the remainders of aa and bb, respectively, when divided by kk.

Task

Given the numbers kk, xx, yy, and the sum s=a+bs = a+b, determine if we can choose two numbers aa and bb that meet Martin's conditions.

Input data

The first line contains 4 numbers kk, xx, yy, and ss as described in the statement.

Output data

If two numbers can be chosen to meet the conditions, print DA (yes in Romanian), otherwise print NU (no in Romanian).

Constraints and clarifications

  • 1k1 000 000 0001 \leq k \leq 1\ 000\ 000\ 000;
  • 0x,y<k0 \leq x, y < k;
  • 1s2 000 000 0001 \leq s \leq 2\ 000\ 000\ 000;

Example 1

stdin

5 2 4 11

stdout

DA

Explanation

The solution a=7a=7 and b=4b=4 meets the conditions.

Example 2

stdin

7 2 5 9

stdout

NU

Log in or sign up to be able to send submissions!