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