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