#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C;
  scanf("%d%d%d", &A, &B, &C);
  if ((B > A && C < 0) || (B < A && C > 0))
    cout << "NO";
  else {
    if (C == 0) {
      if (A == B)
        cout << "YES";
      else
        cout << "NO";
    } else {
      B -= A;
      if ((B % C) == 0)
        cout << "YES";
      else
        cout << "NO";
    }
  }
  return 0;
}
