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