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