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