#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c;
  cin >> a >> c >> b;
  if (b == 0) {
    if (a == c)
      printf("YES\n");
    else
      printf("NO\n");
    return 0;
  }
  if ((c - a) % b == 0 && (c - a) / b >= 0)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
