#include <bits/stdc++.h>
int main(int argc, char const *argv[]) {
  int a, b, c;
  std::cin >> a >> b >> c;
  if (c == 0) {
    std::cout << (a == b ? "YES" : "NO") << std::endl;
    return 0;
  }
  std::cout << (((b - a) % c) || ((b - a) / c < 0) ? "NO" : "YES") << std::endl;
  return 0;
}
