#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int a, b, c;
  cin >> a >> b >> c;
  b -= a;
  if (b < 0 && c > 0)
    puts("NO");
  else if (b > 0 && c < 0)
    puts("NO");
  else if (c == 0 && b == 0)
    puts("YES");
  else if (c == 0)
    puts("NO");
  else if (b % c == 0)
    puts("YES");
  else
    puts("NO");
  return 0;
}
