#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c;
  cin >> a >> b >> c;
  bool flag = 0;
  if (c != 0) {
    if ((b - a) % c == 0)
      if (((b < a && c < 0) || (b >= a && c >= 0) || (b == a))) flag = 1;
  } else if (b == a)
    flag = 1;
  if (flag)
    cout << "YES";
  else
    cout << "NO";
}
