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