#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c;
  cin >> a >> b >> c;
  if (a == b) {
    cout << "YES";
    return 0;
  }
  if (c == 0) {
    cout << "NO";
    return 0;
  }
  b -= a;
  if (abs(b) % abs(c) != 0) {
    cout << "NO";
    return 0;
  }
  long long x = b / c;
  if (x >= 0)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
