#K50432. Sum of Two Distinct Multiples

    ID: 28863 Type: Default 1000ms 256MiB

Sum of Two Distinct Multiples

Sum of Two Distinct Multiples

Given three positive integers \(X\), \(P\), and \(Q\), determine whether it is possible to represent \(X\) as the sum of exactly two distinct positive integers \(a\) and \(b\) such that:

  • \(a\) is an exact multiple of \(P\), i.e. \(a = k \times P\) for some positive integer \(k\).
  • \(b\) is an exact multiple of \(Q\), i.e. \(b = l \times Q\) for some positive integer \(l\).
  • \(a \neq b\) and \(a + b = X\).

If such a pair exists, output YES; otherwise, output NO.

Note: The integers \(a\) and \(b\) must both be positive and distinct.

inputFormat

The input consists of a single line containing three space-separated integers: \(X\), \(P\), and \(Q\).

outputFormat

Output a single line with the answer: YES if there exists a valid pair \(a\) and \(b\) meeting the conditions, and NO otherwise.

## sample
17 3 5
YES

</p>