#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int N = 1000;
const int M = 10;
const string st2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string s1 = "abcdefghijklmnopqrstuvwxyz";
int n, m, k;
int main() {
  int n, k, m;
  cin >> n >> k >> m;
  if (m == 0) {
    if (k != n)
      cout << "NO"
           << "\n";
    else
      cout << "YES"
           << "\n";
  }
  if (m > 0) {
    if (k < n)
      cout << "NO"
           << "\n";
    else if (n <= 0) {
      if ((abs(n) + k) % m == 0)
        cout << "YES"
             << "\n";
      else
        cout << "NO"
             << "\n";
    } else if ((k - n) % m == 0)
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
  if (m < 0) {
    m = abs(m);
    if (k > n)
      cout << "NO"
           << "\n";
    else if (n <= 0 || (n > 0 && k > 0)) {
      if ((n - k) % m == 0)
        cout << "YES"
             << "\n";
      else
        cout << "NO"
             << "\n";
    } else if ((n + abs(k)) % m == 0)
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
}
