#include <bits/stdc++.h>
int main() {
  int n[3];
  int x, m;
  scanf("%d %d %d", &n[0], &n[1], &n[2]);
  x = (n[1] - n[0]);
  if (n[1] == n[0])
    printf("YES");
  else if (n[2] != 0 && x / n[2] >= 0 && x % n[2] == 0)
    printf("YES");
  else
    printf("NO");
  return 0;
}
