#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b,
                    long long int m = 1000000007) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long int c = power(a, b / 2, m);
  if (b % 2 == 0) return ((c % m) * (c % m)) % m;
  return ((((c % m) * (c % m)) % m) * (a % m)) % m;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, k, m, i, j, cs = 0, t;
  t = 1;
  string s;
  while (t--) {
    double a, b, c;
    cin >> a >> b >> c;
    b -= a;
    if (c == 0) {
      if (b == 0)
        cout << "YES";
      else
        cout << "NO";
      break;
    }
    if ((ceil(b / c) == floor(b / c) && floor(b / c) >= 0))
      cout << "YES";
    else
      cout << "NO";
    cout << "\n";
  }
  return 0;
}
