#include <bits/stdc++.h>
using namespace std;
int main() {
  long int a, b, c;
  int m = 0, j;
  scanf("%ld ", &a);
  scanf("%ld ", &b);
  scanf("%ld ", &c);
  if (c == 0) {
    if (a == b)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  } else {
    if ((b - a) % c == 0 && (b - a) / c >= 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
