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