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