#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 3e5 + 10;
const int inf = 2e9;
const double eps = 1e-7;
const long long INF = (long long)1e18;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (c == 0) {
    if (a == b)
      cout << "YES";
    else
      cout << "NO";
    return 0;
  }
  int k = (b - a) % c;
  if (k == 0 && ((b - a) / c) >= 0)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
