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