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