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