#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (c == 0) {
    if (a == b) {
      cout << "YES";
      return 0;
    } else {
      cout << "NO";
      return 0;
    }
  } else if (c > 0) {
    if (a > b) {
      cout << "NO";
      return 0;
    } else if ((b - a) % c == 0) {
      cout << "YES";
      return 0;
    } else {
      cout << "NO";
      return 0;
    }
  } else {
    if (b > a) {
      cout << "NO";
      return 0;
    } else {
      if ((b - a) % c == 0) {
        cout << "YES";
        return 0;
      } else {
        cout << "NO";
        return 0;
      }
    }
  }
  return 0;
}
