#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int read() {
  int ret = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  for (; ch >= '0' && ch <= '9'; ch = getchar()) ret = ret * 10 + ch - '0';
  return ret;
}
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b)
    printf("YES\n");
  else if (c == 0) {
    if (b == a)
      printf("YES\n");
    else
      printf("NO\n");
  } else if (c > 0) {
    if (a >= b)
      printf("NO\n");
    else {
      if ((b - a) % c == 0)
        printf("YES\n");
      else
        printf("NO\n");
    }
  } else {
    if (a <= b)
      printf("NO\n");
    else {
      if ((a - b) % (-c) == 0)
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
}
