#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793;
const long long MOD = 1e9 + 7, INF = 1e9 + 10;
long long a, b, c;
int main() {
  cin >> a >> b >> c;
  if (!c) {
    if (b == a)
      cout << "YES\n";
    else
      cout << "NO\n";
    return 0;
  }
  long long tmp = (b - a) / c;
  if (tmp * c == b - a && tmp >= 0)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
