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