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