#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, b, c;
  cin >> a >> b >> c;
  if (c == 0) {
    if (a == b)
      cout << "YES";
    else
      cout << "NO";
    return 0;
  }
  double n = (b - a) / c;
  int nn = n + 1;
  if (nn <= 0) {
    cout << "NO";
    return 0;
  }
  double ans = a + (nn - 1) * c;
  if (ans == b)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
