#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> a >> b >> c;
  int x = b - a;
  if (b == a) {
    cout << "YES";
    return 0;
  }
  if (c == 0) {
    cout << (x ? "NO" : "YES");
  } else if (c > 0) {
    cout << (x > 0 && !(x % c) ? "YES" : "NO");
  } else {
    cout << (x < 0 && !(x % c) ? "YES" : "NO");
  }
  return 0;
}
