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