#include <bits/stdc++.h>
int main() {
  long long int a, d, b;
  scanf("%lld %lld %lld", &a, &b, &d);
  if (d != 0 && (b - a) % d == 0 && 1 + (b - a) / d >= 1) {
    printf("YES\n");
  } else if (d == 0 && a == b) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  return 0;
}
