Vasya likes everything infinite. Now he is studying the properties of a sequence s, such that its first element is equal to a (s1 = a), and the difference between any two neighbouring elements is equal to c (si - si - 1 = c). In particular, Vasya wonders if his favourite integer b appears in this sequence, that is, there exists a positive integer i, such that si = b. Of course, you are the person he asks for a help.

The first line of the input contain three integers a, b and c ( - 109 ≤ a, b, c ≤ 109) — the first element of the sequence, Vasya's favorite number and the difference between any two neighbouring elements of the sequence, respectively.

If b appears in the sequence s print "YES" (without quotes), otherwise print "NO" (without quotes).

NoteIn the first sample, the sequence starts from integers 1, 4, 7, so 7 is its element.In the second sample, the favorite integer of Vasya is equal to the first element of the sequence.In the third sample all elements of the sequence are greater than Vasya's favorite integer.In the fourth sample, the sequence starts from 0, 50, 100, and all the following elements are greater than Vasya's favorite integer.

#include<iostream>
using namespace std;
long long a,b,c;
int main()
{
	cin>>a>>b>>c;
	if(a==b)
	{
		cout<<"YES";
		return 0;
	}
		if(c==0 && a==b)
		{
			cout<<"YES";
			return 0;
		}

		if(c==0 && a!=b)
		{
			cout<<"NO";
			return 0;
		}

	if(a<b && c<0)
	{
		cout<<"NO";
		return 0;
	}

	if(a>b && c>0)
	{
		cout<<"NO";
		return 0;
	}

	if((b-a)%c==0)
		cout<<"YES";
			else
		cout<<"NO";
}

#include <cstdio>
#include <cmath>
#include <iostream>

int main()
{
    int a, b, c;
    bool ans = false;

    scanf("%d %d %d", &a, &b, &c);

    if(!c){
        if(a == b)
            ans = true;
    }
    else if(c > 0){
        if( b >= a && (b - a) % c == 0 )
            ans = true;
    }
    else if( b <= a && (b - a) % c == 0 )
        ans = true;

    if( ans )
        printf("YES\n");
    else
        printf("NO\n");

}

// 1536706014380

#include <iostream>
using namespace std;
int a,b,c;
int main()
{
	cin>>a>>b>>c;
	if (c==0)
	{
		if (a==b) cout<<"YES";
		else cout<<"NO";
	}
    else if (a==b || (b-a)%c==0&&(b-a)/c>0) cout<<"YES";
    else cout<<"NO";
}

#include <cstdio>

using namespace std;

int main()
{
    //freopen("a.in","r",stdin);
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(c==0)
    {
        if(a==b)printf("YES");
        else
         printf("NO");
        return 0;
    }
    if(c>0)
    {int r1=b%c,r2=a%c;
    if(r1<0)r1*=-1;
    if(r2<0)r2*=-1;
    if(r1==r2 && b>=a )printf("YES");
    else
        {
          if(r1+r2==c&&b>=a&&a<0)printf("YES");
    else
        printf("NO");
        }
        return 0;
    }
    int r1=b%c,r2=a%c;
    if(c==-1)
    {
        if(a>=b)printf("YES");

        else
            printf("NO");
        return 0;
    }
    if(r1>0)r1*=-1;
    if(r2>0)r2*=-1;
    if(r1==0&&r2==0&&b<=a)
    {
        printf("YES");
        return 0;
    }

    if(r1==r2 && b<=a && a>=0 &&b>=0)printf("YES");
    else
    {
        if(r1==r2&&b<=a&&a<0&&b<0)printf("YES");
        else
        {
            if(r1+r2==c&&b<= a&& a>=0)printf("YES");
            else
            printf("NO");
        }
    }
    return 0;
}

#include <iostream>
using namespace std;
#define int64 long long
int main()
{
	int64 a,b,c;
	cin >> a >> b >> c;
	if (c == 0 && a != b)
	{
		cout << "NO"; return 0;
	}
	if (a == b){ cout << "YES"; return 0; }

	else
	{
		if ((a > b && c < 0) || (a<b && c > 0))
		{
			int64 d = a - b;

			if (d%c==0)
			{
				cout << "YES";
				return 0;
			}
			else
			{
				cout << "NO";
				return 0;
			}
		}

		else
		{
			if ((a > b && c > 0) || (a < b && c < 0)){ cout << "NO"; }
			return 0;
		}
	}
	cout << "YES";
	return 0;
}

#include <cstdio>
int main() {
	int a, b, c;
	int tmp;
	scanf("%d %d %d", &a, &b, &c);
	tmp = b - a;
	if (tmp <= 0 && c <= 0) {
		tmp = -tmp;
		c = -c;
	}
	if ((tmp < 0) ^ (c < 0)) printf("NO");
	else if (c == 0) {
		if (tmp == 0) printf("YES");
		else printf("NO");
	}
	else if ((tmp % c == 0)) printf("YES");
	else printf("NO");
	return 0;
}

#include <bits/stdc++.h>
#include<algorithm>
#include<string>
using namespace std;

int main()
{
    double a,b,c,z;
    cin>>a>>b>>c;
    if (c!=0)
    {
        z=(b-a)/c;
    }
    else if (c==0&& a==b)
    {
        cout<<"Yes";
        return 0;
    }
    else
    {
        cout<<"No";
        return 0;
    }

    if(z== int (z)&&z>=0&&c!=0)
        cout<<"Yes";

    else
        cout<<"No";
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{

    long long int a, b, c;
    cin >> a >> b >> c;
    if (a==b)cout << "YES";
    else if (!c)cout << "NO";
    else if((abs(b-a)%abs(c))==0 && !((b-a<0 && c>=0) || (b-a>0 && c<=0)))
    cout << "YES";
    else cout << "NO";
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

#define all(v) 			((v).begin()), ((v).end())
#define allr(v)			((v).rbegin()), ((v).rend())
#define sz(v) 			((int)((v).size()))

typedef long long ll;

void File()
{
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
}
void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
}
const double pi = 2 * acos(0.0);
const int nn = 1e5 + 4;
const int oo = 0x3f3f3f3f;

int main()
{
	fast();
	ll a, b, c;
	cin >> a >> b >> c;
	if (c == 0)
	{
		if (a == b)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	else
	{
		if ((b - a) % c == 0 && (b - a) / c >= 0)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
#if _DEBUG
	system("pause");
#endif
	return 0;
}

#include <iostream>

using namespace std;

int modul(int a){
    if(a<0){
        return -a;
    }
    else{
        return a;
    }

}

int afisare(int a, int b, int c){
    if(c==0){
        if(a==b){
            return 1;
        }
        else{
            return 0;
        }
    }
    int k=b-a;
    if(k/c<0 || k%c!=0){
        return 0;
    }
    else{
        return 1;
    }
}

int main()
{
    int a, b, c;
    cin>>a>>b>>c;
    int k=afisare(a, b, c);
    if(k==0){
        cout<<"NO";
    }
    else{
        cout<<"YES";
    }
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    ll a , b, c;
    cin >> a >> b >> c ;

    if( a==b ){
        cout << "YES\n";
        return 0;
    }
    else if( c==0 and a !=b )
    {
        cout<<"NO\n";
        return 0;
    }
    else  if( c==0 and a==b )
    {
        cout << "YES\n";
        return 0;
    }
    else if( b<a and c>0 )
    {
        cout << "NO\n";
        return 0;
    }
    else if( b >a and c<0 )
    {
        cout << "NO\n";
        return 0;
    }

    if( (b-a)%c ==0 )
        cout << "YES\n";
    else
        cout << "NO\n";
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
	long long int a,b,c,d;
	cin>>a>>b>>c;
	 if(a==b)
	cout<<"YES";
	else if(a!=b&&c==0)
	cout<<"NO";
else if(a<0&&c<0&&b>=0)
cout<<"NO";
else if(a>=0&&c>=0&&b<0)
cout<<"NO";
else if(a<0&&c>0&&a+c>b)
cout<<"NO";
else if(a>0&&c<0&&a+c<=0&&b>0)
cout<<"NO";
else if(a<=0&&b<0&&c<0&&a+c<b)
cout<<"NO";
else if(a==0&&b>0&&c<0)
cout<<"NO";
else if(a>0&&c>0&&a>b)
cout<<"NO";
	else
	{
if((b-a)%c==0)
		cout<<"YES";
		else
		cout<<"NO";
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main () {
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n,m,c;
	cin>>n>>m>>c;
	m-=n;
	if(m>0 and c<0) {printf("NO");return 0;}
	if(m<0 and c>0) {printf("NO");return 0;}
	if(m!=0 and c==0) {printf("NO");return 0;}
	if(m==0 and c==0) {printf("YES");return 0;}
	if(m%c==0) printf("YES");
	else printf("NO");
	return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(!c)
    {
        if(a==b)puts("YES");
        else puts("NO");
    }
    else if(a==b||(b-a)%c==0&&(b-a)/c>0)puts("YES");
    else puts("NO");
    return 0;
}

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

	return 0;
}

#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

const int maxn = 333;
typedef long long LL;
const LL INF = 1e9;

int main() {
	int a, b, c;
	while (scanf("%d%d%d", &a, &b, &c) == 3) {
		if (c == 0) {
			if (b == a) puts("YES");
			else puts("NO");
			continue;
		}
		LL low, hig; int flag;
		if (c < 0) {
			flag = 0;
			low=0, hig = (-INF-a)/c+10;
			//printf("hig:%lld\n", hig);
			if (b > a) {
				puts("NO"); continue;
			}
			while (low < hig-1) {
				LL mid = low + (hig - low) / 2;
				if (a + mid*c>b) {
					low = mid + 1;
				}
				else if (a + mid*c < b) {
					hig = mid;
				}
				else {
					flag = 1; break;
				}
			}
			if (flag||a+low*c==b) puts("YES");
			else puts("NO");
		}
		else if (c>0) {
			flag = 0;
			low = 0, hig = (INF-a)/c+10;
			//printf("hig:%lld\n", hig);
			if (b < a) {
				puts("NO"); continue;
			}
			while (low < hig - 1) {
				LL mid = low + (hig - low) / 2;
				if (a + mid*c<b) {
					low = mid + 1;
				}
				else if (a + mid*c > b) {
					hig = mid;
				}
				else {
					flag = 1; break;
				}
			}
			if (flag||a+low*c==b) puts("YES");
			else puts("NO");
		}
	}
	return 0;
}
/*
1 7 3
10 10 0
1 -4 5
0 60 50

0 2 -1
0 2 0

0 0 -1
1000000000 999999999 1
*/

#include <stdio.h>
#include<iostream>
#include<set>
#include<algorithm>
#include <limits>
#include<math.h>
#include<ctype.h>
#include<string.h>
#include<vector>
#include <iomanip>
#include <locale>
#include <sstream>
using namespace std;

int main()
{
   //freopen("A-large.in","r", stdin);
    //freopen ("A-large.out","w",stdout);
long long a,b,c,x;
cin>>a>>b>>c;
if(c==0)
{  if(a!=b)
    {
    cout<<"NO"<<endl;
    return 0;
    }
    else
    {
    cout<<"YES"<<endl;
    return 0;
        }
}
if((a-b)/c<=0&&(a-b)%c==0)
    cout<<"YES"<<endl;
else
    cout<<"NO"<<endl;

    return 0;
}

#include<iostream>
#include<string>
#include<map>
#include<set>
#include<algorithm>
#include<vector>
using namespace std;
int gcd ( int a, int b )
{
  int c;
  while ( a != 0 ) {
     c = a; a = b%a;  b = c;
  }
  return b;
}
bool prime(long long x)
{
	if (x==2)
		return true;
	if (x%2==0||x<2)
		return false;
	for (int i=3;i*i<=x;i+=2)
		if (x%i==0)
			 return false;
	return true;
}
int main()
{
	long long a,b,c;
	cin>>a>>b>>c;
	if(a==b)
	{
		cout<<"YES"<<endl;
		exit(0);
	}
	if((a>b&&c>0)||(b>a&&c<0)||(a!=b&&c==0))
	{
		cout<<"NO"<<endl;
		exit(0);
	}
	if((b-a)%c==0)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;

	return 0;
}

#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"<<endl;
        else cout << "NO"<<endl;
    } else {
        if ((b - a) % c == 0 && (b - a) / c >= 0) cout << "YES"<<endl;
        else cout << "NO"<<endl;
    }
}

#include <iostream>
using namespace std;
int main()
{
    int a,b,c,s=0,i;
   cin>>a>>b>>c;
   if(a==b)s++;
    else
    {
        if (c>0)
        {
            if(b>a)
            {
                if(c==1)s++;
                else{
                for(i=a;i<=b;i+=c)
                {
                    if(i==b)s++;
                }
                }
            }
        }
        else if (c<0)
        {
            if(a>b)
                {
                    if(c==-1)s++;
                else{
                      for(i=a;i>=b;i+=c)
                    {
                        if(i==b)s++;
                    }
                }
                }
        }
    }
   if(s) cout<<"YES";
   else cout<<"NO";
   return 0;
}

#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

int main()
{
    int a,b,c,count;
    string out="NO";
    cin>>a>>b>>c;
    int x=b-a;
    if(c==0)
      {if(a==b)
      out="YES";}
    else
    {
     if(x/c>=0 && x%c==0)
      out="YES";}
    cout<<out;
    return 0;

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int a,b,c;
    int m=0,j;
    scanf("%ld ",&a);
    scanf("%ld ",&b);
    scanf("%ld ",&c);

      if(c==0)
      {
          if(a==b)
            cout<<"YES"<<endl;
          else
            cout<<"NO"<<endl;
      }
      else {
        if ((b - a) % c == 0 && (b - a) / c >= 0) cout << "YES"<<endl;
        else cout << "NO"<<endl;
    }
}

#include <stdio.h>
#include <algorithm>
#include <fstream>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;
const char FVD[] = "duom.txt";
const char FVR[] = "rez.txt";

#define ll long long
#define ld long double

#define pb push_back
#define mp make_pair

#define c(x) cout << x << ' ' <<'\n'
#define cn(x) cout << x << ' '
#define stop cin.get();

// for
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)

// For the sort functions
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define reset(_A, _B)   memset((_A), (_B), sizeof (_A))

const int MaxN = 1e5 + 10;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {

   ifstream D(FVD);
   ofstream R(FVR);

   ll a;
   ll b;
   ll c;

    cin>>a>>b>>c;
    if(c==0){
        if(a==b) cout<<"YES";
        else cout<<"NO";
        return 0;
    }

    if((b-a)%c==0 && (b-a)/c>=0) cout<<"YES";
    else cout << "NO";
   return 0;
}

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

#include <iostream>
using namespace std;

int main()
{  int a, b , c;
   cin >> a >> b >> c;
   if (c == 0){
    if (a == b){cout << "YES";}
    else {cout << "NO";}
   }
   else {
    if ((b-a)%c == 0 && (b-a)/c >= 0){cout << "YES";}
    else {cout << "NO";}
   }
   }

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

#include <bits/stdc++.h>

using namespace std;

int main() {
    long long min,fav,diff;
    cin >> min >> fav >> diff;
    if(fav==min){
        cout<<"YES";
    }
    else if(diff==0){
        if(min==fav){
            cout<<"YES";
        }
        else{
            cout<<"NO";
        }
    }
    else {
        if (fav > min) {
            if (diff > 0) {
                if (((fav - min) % diff) == 0) {
                    cout << "YES";
                }
                else {
                    cout << "NO";
                }
            }
            else {
                cout << "NO";
            }
        }
        else if(fav<=min){
            if (diff < 0) {
                if (((min-fav) % diff) == 0) {
                    cout << "YES";
                }
                else{
                    cout <<"NO";
                }
            }
            else {
                cout << "NO";
            }
        }

    }
    return 0;

}

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

#define all(v) 			((v).begin()), ((v).end())
#define allr(v)			((v).rbegin()), ((v).rend())
#define sz(v) 			((int)((v).size()))

typedef long long ll;

void File()
{
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
}
void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
}
const double pi = 2 * acos(0.0);
const int nn = 1e6 + 4;
const int oo = 0x3f3f3f3f;
ll a, b, c;
int main()
{
	fast();
	cin >> a >> b >> c;
	if (c == 0)
	{
		if (a == b)
			cout << "YES\n";
		else
			cout << "NO\n";
		return 0;
	}
	if ((b - a) % c == 0 && ((b - a) / c) >= 0)
		cout << "YES\n";
	else
		cout << "NO\n";
#if _DEBUG
	system("pause");
#endif
	return 0;
}

#include<stdio.h>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	if(c==0)
	{
		if(b==a)
		{
			printf("YES");return 0;
		}
		else
		{
			printf("NO");return 0;
		}
	}
	if(c>0)
	{
		if(a<=b&&(b-a)%c==0)
		{
			printf("YES");return 0;
		}
		else
		{
			printf("NO");return 0;
		}
	}
	if(c<0)
	{
		if(b<=a&&(a-b)%c==0)
		{
			printf("YES");return 0;
		}
		else
		{
			printf("NO");return 0;
		}
	}
	return 0;
}

#include <iostream>
using namespace std;
int main() {
	int n, k, c;
	cin >> n >> k >> c;
	if (k == n) { cout << "YES"; exit(0); }
	if (c == 0) { if (k == n) { cout << "YES"; exit(0); } else { cout << "NO"; exit(0); } }
	if ((k - n) % c == 0 && (k - n) / c > 0){
		cout << "YES";
	}
	else {
		cout << "NO";
	}
}

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long int
#define MAX 100005
int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    if(a > b && c >= 0)
    {
        printf("NO\n");
        return 0;
    }
    if(a < b && c <= 0)
    {
        printf("NO\n");
        return 0;
    }
    if(c == 0)
    {
        printf("YES\n");
        return 0;
    }
    b -= a;
    if(b < 0 && c < 0)
    {
        b *= -1;
        c *= -1;
    }
    if(b % c == 0)
    {
        printf("YES\n");
    }
    else
        printf("NO\n");
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll a,b,c,d,i,j,k,l;
cin>>a>>b>>c;
if(a<=b)
{
if(a==b)cout<<"YES\n";
else if(c==0)cout<<"NO\n";
else if(abs(a-b)%abs(c)==0&&c>0)cout<<"YES\n";
else cout<<"NO\n";
}
else if(a>b&&c<0)

  {
if(a==b)cout<<"YES\n";
       else if(c==0)cout<<"NO\n";
else if(abs(a-b)%abs(c)==0)cout<<"YES\n";
//else if(a+b%abs(c)==0)cout<<"YES\n";
else cout<<"NO\n";
}
    else cout<<"NO\n";

}

// sudoankit codeforces
#include<iostream>
#include<cstdio>
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);i++)
#define sc(n) scanf("%d",&n)
using namespace std;
///////////////////////////////////////////////
int main(){

	int a,b,c;
	sc(a);
	sc(b);
	sc(c);

	if(c == 0){
		if(a == b){
			printf("YES\n");
		}
		else
			printf("NO\n");
	}
	else{
		if((b-a)% c == 0 && (b-a)/ c >= 0){
			printf("YES\n");
		}
		else
			printf("NO\n");
	}

	return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int a,b,c; cin>>a>>b>>c;
    if ((c>0 && b>=a && (b-a)%c==0)||(c==0&&b==a)||(c<0 && b<=a && (b-a)%c==0)) cout<<"YES";
    else cout<<"NO";
}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int a,b,c;
cin>>a>>b>>c;
	if(c==0&&(a==b))
	cout<<"YES";
	else if(c==0&&(a!=b))
	cout<<"NO";
	else if(c==1&&b>=a)
	cout<<"YES";
	else if(a==b&&b==c)
	cout<<"YES";
	else if(a<0||b<0||c<0)
	{
		if(c<0){

	while(a>b)
	a=a+c;
	if(a<b)
	cout<<"NO";
	else
	cout<<"YES";

	}
	else
	{

		while(a<b)
		a=a+c;
		if(a>b)
	cout<<"NO";
	else
	cout<<"YES";
	}

	}
		else if(b%c==a)
	cout<<"YES";
	else
	cout<<"NO";

		return 0;
}

#include <iostream>
#include <cstring>
#include <cmath>
#include <stdio.h>
#include <algorithm>
using namespace std;
/*
struct stack
{
	stack *next, *head;
	int *pril;
};

void add(stack *&s, int *x)
{
	stack *s1 = new stack;
	s1->pril = x;
	s1->next = s->head;
	s->head = s1;
}

void read(stack*s, int n, long* sum)
{
	stack* s1 = s->head;
	for (int i = 0; i < n; ++i)
	{
		if (*s1->pril > 0)
		{
			(*s1->pril)--;
			(*sum)--;
		}
		s1 = s1->next;
	}
}

void clear(stack* s)
{
	while (s->head != NULL)
	{
		stack*s1 = s->head->next;
		delete[] s->head;
		s->head = s1;
	}
}*/

int   main()
{
//	cout << (-4) % (-5);
	long long f, x, p;
	cin >> f >> x >> p;
	if (p != 0)
	{
		long long f1 = f%p;
		if (f1 < 0) f1 += llabs(p);

		long long x1 = x%p;
		if (x1 < 0) x1 += llabs(p);

		if ((x1==f1)&&(((x > f) && (p > 0)) || ((x < f) && (p < 0))||(x==f))) cout << "YES";
		else cout << "NO";
	}
	else if(x==f) cout << "YES";
	else cout << "NO";

//system("pause");

	return 0;
}

#include "iostream"
using namespace std;
////////////////////

class project
{
private:
    int a,b,c;
public:
    void init();
    void solve();
};

void project::init()
{
    cin>>a>>b>>c;
}

void project::solve()
{
    if(c==0)
    {
        if(a!=b)cout<<"NO"<<endl;
        else cout<<"YES"<<endl;
    }
    else if((a>b&&c>0)||(a<b&&c<0))
        cout<<"NO"<<endl;
    else
    {
        if((b-a)%c==0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

int main()
{
    project p;
    p.init();
    p.solve();
}

#include<bits/stdc++.h>
using namespace std;
#define ll int
#define lli long long int
void fast()
{
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int main()
{
	fast();
	ll a,b,c;
	cin>>a>>b>>c;
	if(c==0)
	{
		if(a==b)
		{
			cout<<"YES\n";
		}
		else cout<<"NO\n";
		return 0;
	}
	ll num=b-a;
	if(num%c==0)
	{
		if(num/c>=0)
		cout<<"YES\n";
		else cout<<"NO\n";
	}
	else cout<<"NO\n";
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair<int, int> pi;
typedef vector<pi> vpi;
typedef pair<int, pi> ppi;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;
#define go_t ll t;cin>>t;while(t--)
#define sz(a)     int((a).size())
#define pb         push_back
#define all(c)     (c).begin(),(c).end()
#define tr(c,i)   for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x)    ((c).find(x) != (c).end())
#define cpresent(c,x)  (find(all(c),x) != (c).end())

#define fast      ios::sync_with_stdio(0);cin.tie(0);
#define ll          long long int
typedef long double ld;
#define ull        unsigned long long

#define MIN3(a,b,c)     (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))
#define MAX(a,b)         (a)>(b)?(a):(b)
#define MIN2(a,b)        (a)<(b)?(a):(b)
#define fr(n) for(ll i=0;i<n;i++)

inline bool is_palindrome(const string& s){ return std::equal(s.begin(), s.end(), s.rbegin()); }
const ll MOD = 1000000007;
// const ll MOD = 10000009;
const ll INF = 1e9+5;

#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
#define ff first
#define ss second

bool check(ll a,ll b, ll c){
    if(c == 0)
        return a == b;
    return ((b-a)%c == 0 && (b-a)/c >=0);
}

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    // cout<<n;
    if(check(a,b,c))
        cout<<"YES";
    else cout<<"NO";
    return 0;
}

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

#include <iostream>
using namespace std;
int main()
{
    int a,b,c,s=0,i;
   cin>>a>>b>>c;
   if(a==b)s++;
    else
    {
        if (c>0)
        {
            if(b>a)
            {
                if(c==1)s++;
                else{
                for(i=a;i<=b;i+=c)
                {
                    if(i==b)s++;
                }
                }
            }
        }
        else if (c<0)
        {
            if(a>b)
                {
                    if(c==-1)s++;
                else{
                      for(i=a;i>=b;i+=c)
                    {
                        if(i==b)s++;
                    }
                }
                }
        }
    }
   if(s) cout<<"YES";
   else cout<<"NO";
   return 0;
}

#include<iostream>
using namespace std;
int main()
{
    long long a,b,c;
    cin>>a>>b>>c;
    if(c==0)
    {
        if(a!=b)
            cout<<"NO";
        else
            cout<<"YES";
    }
    else{
        b-=a;
        if(b*c<0)
            cout<<"NO";
        else{
            if(b%c==0)
                cout<<"YES";
            else
                cout<<"NO";
        }
    }
    return 0;
}

#include <cstdio>
#include <cmath>
#include <iostream>

int main()
{
    int a, b, c;
    bool ans = false;

    scanf("%d %d %d", &a, &b, &c);

    if(!c){
        if(a == b)
            ans = true;
    }
    else if(c > 0){
        if( b >= a && (b - a) % c == 0 )
            ans = true;
    }
    else if( b <= a && (b - a) % c == 0 )
        ans = true;

    if( ans )
        printf("YES\n");
    else
        printf("NO\n");

}

// 1536706014380

#include<bits/stdc++.h>

using namespace std;
#define LL long long

int main()
{
    LL a,b,c,d,i,j;
    while(cin>>a>>b>>c)
    {

    if((a==b && c==0)|| a==b) cout<<"YES"<<endl;
    else if(a!=b && c==0) cout<<"NO"<<endl;
    else
    {
        if((b-a>0 && c>0))
        {
            if((b-a)%c==0) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
        else if(b-a<0 && c<0)
        {
            if((a-b)%(-c)==0) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
        else cout<<"NO"<<endl;
    }

    }
    return 0;

}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

long long f(long long a, long long b)
{
	a %= b;
	if (a < 0)
		a += b;
	return a;
}
int main()
{
	long long a, b, c;
	cin >> a >> b >> c;
	if ((c == 0 && a != b) || (c > 0 && b < a) || (c < 0 && a < b))
	{
		cout << "NO" << endl;
		return 0;
	}
	if ((c == 0 && a == b) || (a == b))
	{
		cout << "YES" << endl;
		return 0;
	}
	if (c < 0)
	{
		swap(a, b);
		c = 0 - c;
	}
	if (f((b + c), c) == f((a+ c ), c) || f((a + c), c) == f((b + c), c))
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}

#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main(){
	int a,b,c;
	while((scanf("%d%d%d",&a,&b,&c))!=EOF){
		if((a>b&&c>0)||(a<b&&c<0)||(a!=b&&c==0)){
			cout<<"NO\n";
			continue;
		}
		if(c==1||c==-1||a==b){
			cout<<"YES\n";
			continue;
		}
		if(a>b){
		  if((a-b)%abs(c)==0){
		  	cout<<"YES\n";
		  	continue;
		  }
		  else
		    cout<<"NO\n";
		}
		else{
			if((b-a)%c==0)
			  cout<<"YES\n";
			else
			  cout<<"NO\n";
		}
	}
return 0;
}

#include<iostream>
//nouromran
using namespace std;
int x,y,z;
int main(){
int a,b,c;
cin>>a>>b>>c;
if ( a<-10000 && c> 10000){cout<<"YES"<<endl;return 0;}
if ( !c ) {
if ( a == b ) {cout<< "YES"<<endl;return 0 ;}
cout<<"NO"<<endl;return 0;
}
x=((b+c)-a)/c;z=a+((x-1)*c);
if ( !x  ||  x < 0 ){cout<<"NO"<<endl;return 0;}
(z==b) ? cout<< "YES"<<endl: cout<<"NO"<<endl;
return 0;
}

#include <cstdio>
using namespace std;
typedef long long ll;

int main() {
	ll a, b, c;
	scanf("%lli%lli%lli",&a,&b,&c);
	if(c==0 && b!=a) {
		printf("NO");
		return 0;
	}
	if(a==b) {
		printf("YES");
		return 0;
	}
	if(c < 0) {
		a = -a;
		b = -b;
		c = -c;
	}
	if(b<a) {
		printf("NO");
		return 0;
	}
	if((b - a)%c==0) {
		printf("YES");
		return 0;
	}
	else{
		printf("NO");
		return 0;
	}
}
// 1488580088248

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long i,j,k,n,m,x,y,a,b,c;
    cin>>a>>b>>c;

    if(c==0 && a==b)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    else if(c==0 && a!=b)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    if(a==b)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    while(1)
    {
        if((b-a)/c>=0 && (b-a)%c==0)
        {
            cout<<"YES"<<endl;
            return 0;
        }
        a=a+c;
        if(a==b)
        {
            cout<<"YES"<<endl;
            return 0;
        }
        if(a>b)
        {
            break;
        }
        if((b-a)/c<0)
        {
            cout<<"NO"<<endl;
            return 0;
        }

    }
    cout<<"NO"<<endl;
}

#include <bits/stdc++.h>

using namespace std;

int main(){
	int a, b, c;
	cin >> a >> b >> c;

	if( a == b && c == 0) cout << "YES" << endl;
	else if ( c == 0 ) cout << "NO" << endl;
	else {
		if ( ( b - a ) % c == 0 && ( b - a ) / c >= 0 )
			cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

#include<iostream>
using namespace std;
int main()
{
	long long a, b, c;
	cin >> a >> b >> c;
	if (a == b)
		cout << "YES";

	else if (b - a>0 && c>0 && (b - a) % c == 0)
		cout << "YES";

	else if (b - a<0 && c<0 && (a - b) % c == 0)

			cout << "YES" ;

	else
		cout << "NO" ;
 return 0;
}

#include<iostream>
#include<cstdio>
#include<cmath>
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    bool flag=0;
    if (c==0&&a==b) flag=1;
    if (c>0&&a<=b&&(b-a)%c==0) flag=1;
    if (c<0&&a>=b&&(a-b)%c==0) flag=1;
    if (flag) printf("YES\n");
    else printf("NO\n");
    return 0;
}

#include <iostream>
using namespace std;

int main()
{
    int a, fav, b;
    cin >> a >> fav >> b;
    if (b == 0)
    {
        if ( a == fav)
        {
            cout << "YES";
            return 0;
        }
        else
        {
            cout << "NO";
            return 0;
        }
    }

    if ((fav - a)%b == 0 && (fav - a)/b >=0) cout << "YES";
    else cout << "NO";

    return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(!c)
    {
        if(a==b)puts("YES");
        else puts("NO");
    }
    else if(a==b||(b-a)%c==0&&(b-a)/c>0)puts("YES");
    else puts("NO");
    return 0;
}

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

#include <iostream>
#include<math.h>
using namespace std;
int main()
{
double a,b,c;
cin>>a>>b>>c;
if((b<a&&c>=0)||(b>a&&c<=0))
    cout<<"No";
else if(b==a&&c==0)
    cout<<"Yes";
    else
    {
        double y;
        if(b>=a)
         y=(a-b)/-c;
        else if(b<a)
         y=(a-b)/c;
        if(y==floor(y))
        cout<<"Yes";
        else
        cout<<"No";
    }
    return 0;
}

#include <iostream>
using namespace std;

int main()
{
		long long a, b, c;
		cin >> a >> b >> c;
		if ((a == b) || (c && (b - a)*c > 0) && (b - a) % c == 0) {
			cout << "YES";
		}
		else {
			cout << "NO";
		}

	return 0;
}

#include <iostream>
using namespace std;
int main () {
long long a1, an, d;
cin >> a1 >> an >> d;
if (( d != 0 && a1 != an && (an - a1) % d == 0 && (an-a1)/d > 0 ) || a1 == an) cout << "YES";
else cout << "NO";
return 0;
}

// In the name of ALLAH, most Gracious, most Compassionate
// Allah knows the best
// complex but not boring
// Extremist++
// Which of the favors of your Lord will you deny?

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD 1000000007
#define PI acos(-1)

int main(){

  int a,b,c;
  cin>>a>>b>>c;
   if(b>a && c<0) cout<<"NO";
  else if(b<a && c>=0) cout<<"NO";
  else if(c==0){
        if(a==b) cout<<"YES";
        else cout<<"NO";
  }
  else if(c<0){
        if(abs(b-a)%abs(c)==0) cout<<"YES";
        else cout<<"NO";
  }
  else if((b-a)%c==0) cout<<"YES";
  else cout<<"NO";

}

#include <iostream>

using namespace std;

int main()
{
    long long a,b,c;
    cin>>a>>b>>c;
    if(a==b){cout<<"YES";}
    else if(c==0){cout<<"NO";}
    else if(b<a&&c>0){cout<<"NO";}
    else if(a<b&&c<1){cout<<"NO";}
    else if((b-a)%c==0){cout<<"YES";}
    else{cout<<"NO";}
    return 0;
}

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

#include <iostream>
#include <map>

using namespace std;

int main() {
	int a, b, c;
	cin>>a;
	cin>>b;
	cin>>c;
	if (c == 0)
	{
		if (a == b)
			cout<<"YES";
		else cout<<"NO";
	}
	else if (a==b)
		cout<<"YES";
	else
	{
		int k = b - a;
		if (k % c == 0 && k/c > 0)
			cout<<"YES";
		else cout<<"NO";
	}

}

#include<iostream>
using namespace std;
int main()
{
    long long int a,b,c;
    cin>>a>>b>>c;
    if(c!=0&&(b-a)%c==0&&(b-a)/c>=0)
        cout<<"YES";
    else if(a==b)
        cout<<"YES";
    else
        cout<<"NO";

}

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

#define _CRT_SECURE_NO_DEPRECATE
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef long double ldb;
typedef double db;
typedef pair <int, int> pii;
ldb p = 3.14159265358979323, eps = 0.0000001;

# define pb push_back
# define mp make_pair
const int cnt = 100010;
int l, el[300040];
ll res, n, a, b, c;
/*#ifndef_MY_DEBUG
freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif*/
int main()
{
	//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
	cin >> a >> b >> c;
	if (b < a)
	{
		if (c < 0)
		{
			swap(a, b);
			c = -c;
		}
		else
		{
			cout << "NO\n";
			return 0;
		}
	}
	if (a < b && c <= 0)
	{
		cout << "NO\n";
		return 0;
	}
	if (a == b)
	{
		cout << "YES\n";
		return 0;
	}
	if (c == 0 && a != b)
	{
		cout << "NO\n";
		return 0;
	}
	b -= a;
	if (!(b % c))
		cout << "YES\n";
	else
		cout << "NO\n";
	return 0;
}

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

#include <iostream>
#include <string>
#include <iomanip>
#include <math.h>
#include <fstream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long int
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define PI 3.1415926535

double eps = 0.0001;

struct drago
{
	int a ;
	bool operator <(const drago a) const
	{
		return this->a < a.a;

	}

};
int main()
{
	int a,b,c;
	cin >> a >> b >> c;

	if (c == 0)
	{
		if (a == b) cout <<"YES";
		else
		 cout << "NO";
	}
	else
	{
		if (((a >= b && c <= 0) || (a <= b && c >= 0)) && ((b-a) % c == 0))
			cout << "YES";
		else cout <<"NO";
	}
	return 0;
}

#include<iostream>

using namespace std;

int main()
{
    long long a,b,c;
    cin>>a>>b>>c;
    if(c==0)
    {
        if(a==b)
        {
            cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
    }
    else
    {
        if((b-a)%c==0&&(b-a)/c>=0)
            cout<<"YES"<<endl;
        else
           cout<<"NO"<<endl;
    }
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int a,b,c;
	cin>>a>>b>>c;

		if(c!=0)
		{
			if(b>a)
			{
				if(c<0)
				cout<<"NO";
				else
				{
					if((b-a)%c==0)
					cout<<"YES";
					else
					cout<<"NO";
					}
			}
			else if(b<a)
			{
			if(c>0)
            {
            cout<<"NO";
            }

				else
				{

					if((b-a)%c==0)
					cout<<"YES";
					else
					cout<<"NO";
				}
			}
			else if(a==b)
			cout<<"YES";
		}
		else
		{
			if(a==b)
			cout<<"YES";
			else
			cout<<"NO";
		}

	return 0;
}

#include <iostream>

int main(){
  int a,b,c;std::cin>>a>>b>>c;
  c<0&&(c=-c,a=-a,b=-b);
  std::cout<<(b<a||(!c?a!=b:(b-a)%c)?"NO":"YES");
}

#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
#define re register
using namespace std;
const int N=10005;
template<typename t>inline void read(t&x) {
	x=0;
	int f=1;
	char ch=getchar();
	while(!isdigit(ch)) {
		if(ch='-') f=-1;
		ch=getchar();
	}
	while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch-48),ch=getchar();
	x*=f;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
    int a,b,c;
    read(a),read(b),read(c);
    if(a==b){
    	printf("YES\n");
    	return 0;
	}
    if(c>0&&b>a&&(b-a)%c==0){
    	printf("YES\n");
    	return 0;
	}
	else
	if(c<0&&a>b&&(a-b)%c==0){
		printf("YES\n");
    	return 0;
	}
	else
	{
		printf("NO\n");
    	return 0;
	}
    return 0;
}

#include <iostream>
using namespace std;
int main(){
	long long int a,b,c;
	cin>>a>>b>>c;
	if((b>a&&c<0) || (b<a && c>0))cout<<"NO";
	else if(c==0){
		if(a==b)cout<<"YES";
		else cout<<"NO";
	}
	else{
	if((b-a)%c==0)cout<<"YES";
	else cout<<"NO";
	}
	return 0;
}

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    long long a,b,c,d;
    while(cin>>a>>b>>c) {
       if(c==0) {
            if(a==b) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
           }
       else if(a>=0 && c>=0 && b<=0 &&a!=b || a<=0 && c<=0 && b>=0 && a!=b || a>=0 && b>=0 && c>=0 && a>b) {
            cout<<"NO"<<endl;
       }
       else {
           if(a==b) cout<<"YES"<<endl;
           else {
               d = c + b - a;
               if(d%c==0 && d!=0) cout<<"YES"<<endl;
               else cout<<"NO"<<endl;
           }
       }
    }
    return 0;
}

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    long long a, n, c;
    cin >> a >> n >> c;
    if (c == 0)
    {
        if (a == n) cout << "YES";
        else cout << "NO";
    }
    else if (a < n && c < 0) cout << "NO";
    else if (a > n && c > 0) cout << "NO";
    else
    {
        if ((n - a) % c == 0) cout << "YES";
        else cout << "NO";
    }

    return 0;
}
// 6 -1 -7
// 1 6 -1
// if n - a % c
//

#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(!c)//特判差值是0时的情况
    {
        if(a==b)puts("YES");
        else puts("NO");
    }
    else if(a==b||(b-a)%c==0&&(b-a)/c>0)puts("YES");
    else puts("NO");
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;

int main ()
{
    long long a,b,c;
    cin>>a>>b>>c;
    if(a==b&&c==0)
    {
        cout<<"YES";
        return 0;
    }
    if(c==0&&a!=b)
    {
        cout<<"NO";
        return 0;
    }
    if((b-a)%c==0&&((a+c>a&&b>=a)||(a+c<a&&b<=a)))cout<<"YES";
    else cout<<"NO";
}

#include <iostream>
#include <cmath>

using namespace std;

int main() {
    long long a, b, c;
    cin >> a >> b >> c;

    if(a == b && b == c && c == a || (a == b)) {
        cout << "YES" << endl;
        return 0;
    }

    if(c == 0 && a != b) {
        cout << "NO" << endl;
        return 0;
    }

    if(a > b && c > 0) {
        cout << "NO" << endl;
        return 0;
    }

    if(a < b && c < 0) {
        cout << "NO" << endl;
        return 0;
    }

    if((b - a) % c == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;

    if(a >= b)
    while(a >= b) {
        if(b == a) {
            cout << "Yes" << endl;
            return 0;
        }

        a += c;
    }
    else
    while(a <= b) {
        if(b == a) {
            cout << "Yes" << endl;
            return 0;
        }

        a += c;
    }

    cout << "No" << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int n,m,k;
int read()
{
	int x=0,f=1;char ch;
	while(!isdigit(ch)){ch=getchar();if(ch=='-') f=-1;}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48),ch=getchar();}
	return x*f;
}
int main()
{
	n=read();
	m=read();
	k=read();
	if(k>=0)
	{
		if(k==0)
		{
			if(n==m)
			{
				cout<<"YES";
				return 0;
			}
			else
			{
				cout<<"NO";
				return 0;
			}
		}
		else
		{
			if(n>m)
			{
				cout<<"NO";
				return 0;
			}
			else
			{
				if((m-n)%k==0)
				{
					cout<<"YES";
					return 0;
				}
				else
				{
					cout<<"NO";
					return 0;
				}
			}
		}
	}
	else
	{
		if(n<m)
		{
			cout<<"NO";
			return 0;
		}
		else
		{
			if((n-m)%k==0)
			{
				cout<<"YES";
				return 0;
			}
			else
			{
				cout<<"NO";
				return 0;
			}
		}
	}
	return 0;
}

#include <stdio.h>
#include <math.h>

int main()
{
	int	a, b, c;

	scanf ("%d %d %d", &a, &b, &c);

	if (a < b && c > 0)
		while (a < b)
			b -= abs (c);
	else if (c < 0)
		while (a > b)
			b += abs (c);

	printf ("%s", b == a ? "YES" : "NO");

	return 0;
}

#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int func (long long a, long long b, long long c)
{
	if( c == 0)
	{
		if( a == b)
			return 1;
		if ( a != b)
			return 0;
	}
	if( a == b )
		return 1;
	if( b > a & c > 0)
	{ if( ( b - a) % c == 0)
		return 1;
		if( ( b - a) % c !=0)
			return 0;
	}
	if(  b > a & c < 0)
		return 0;
	if( a > b & c > 0)
		return 0;
	if( a > b & c < 0)
	{
		if( (a - b) % c == 0)
			return 1;
		if( (a - b) % c != 0)
			return 0;
	}
}
int main(){
	long long a,b,c;
	cin >> a;
	cin >> b;
	cin >> c;

	if(func(a,b,c) == 1)
		cout << "YES";
	if(func(a,b,c) == 0)
		cout << "NO";

}

#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(!c)
    {
        if(a==b)puts("YES");
        else puts("NO");
    }
    else if(a==b||(b-a)%c==0&&(b-a)/c>0)puts("YES");
    else puts("NO");
    return 0;
}

#include<bits/stdc++.h>

using namespace std;
#define LL long long

int main()
{
    LL a,b,c,d,i,j;
    while(cin>>a>>b>>c)
    {

    if((a==b && c==0)|| a==b) cout<<"YES"<<endl;
    else if(a!=b && c==0) cout<<"NO"<<endl;
    else
    {
        if((b-a>0 && c>0))
        {
            if((b-a)%c==0) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
        else if(b-a<0 && c<0)
        {
            if((a-b)%(-c)==0) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
        else cout<<"NO"<<endl;
    }

    }
    return 0;

}

#include<iostream>
#include<string>
using namespace std;

int main()
{
	long long int first_element, favourite_number, difference;
	cin >> first_element >> favourite_number >> difference;
	bool infinity_sequence = false;

	if ((difference == 0 && favourite_number != first_element) ||
		(first_element < 0 && difference < 0 && favourite_number > first_element) ||
		(first_element > 0 && difference > 0 && favourite_number < first_element)
		)
	{
		cout << "NO" << endl;
	}
	else if ((abs(difference) == 1 && (favourite_number > 0 && difference > 0)) ||
			 (abs(difference) == 1 && (favourite_number < 0 && difference < 0)))
	{
		cout << "YES" << endl;
	}
	else
	{
		if (difference < 0)
		{
			while (first_element >= favourite_number)
			{
				if (first_element == favourite_number)
				{
					infinity_sequence = true;
					break;
				}
				else
				{
					infinity_sequence = false;
				}
				first_element += difference;
			}
		}
		else
		{
			while (first_element <= favourite_number)
			{
				if (first_element == favourite_number)
				{
					infinity_sequence = true;
					break;
				}
				else
				{
					infinity_sequence = false;
				}
				first_element += difference;
			}
		}
		if (!(infinity_sequence))
		{
			cout << "NO" << endl;
		}
		else
		{
			cout << "YES" << endl;
		}
	}

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int a,b,c;

int main()
{
    cin >> a >> b >> c;
    if(c == 0 && a == b){
        cout << "YES";
        return 0;
    }
    else if(c == 0){
        cout << "NO";
        return 0;
    }
    if(b < a && c > 0){
        cout << "NO";
        return 0;
    }
    if(b > a && c < 0){
        cout << "NO";
        return 0;
    }
    int n = (b - a) % c;
    if(n == 0){
        cout << "YES";
        return 0;
    }
    cout << "NO";
    return 0;
}

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long a, b, c;
    cin >> a >> b >> c;

    if (c == 0) {
        if (a == b) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    } else {
        if (c > 0 && a > b) {
            cout << "NO" << endl;
            return 0;
        }
        if (c < 0 && a < b) {
            cout << "NO" << endl;
            return 0;
        }

        long long mod1 = a % c;
        long long mod2 = b % c;

        if (mod1 < 0) mod1 += abs(c);
        if (mod2 < 0) mod2 += abs(c);

        if (mod1 == mod2) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

// 1488581943313

#include <bits/stdc++.h>

using namespace std;

int main()
{
double a, b, c;
cin >> a >> b >> c;
if (a > b && c > 0) {cout << "NO"; return 0;}
if (c == 0 && a == b) {cout << "YES"; return 0;}
if (c == 0 && a != b) {cout << "NO"; return 0;}
double n = (b - a) / c + 1.0;
int x = (int)n;
if (n - x == 0 && n >= 1) cout << "YES";
else cout << "NO";
return 0;
}

///Template Version 2.7 - Made 18th July 2018
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;

#define pb              push_back
#define mp              make_pair
#define file            "ans.txt"
#define F               first
#define S               second
#define gcd             __gcd

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<db, db> pdd;
typedef pair<string, string> pss;

#define ForA(n)  	    for (ll i=0; i<n; i++)
#define ForA2(n)  	    for (ll j=0; j<n; j++)
#define ForAS(n)  	    for (ll i=n; i>0; i--)
#define ForN(n)  	    for (ll i=1; i<=n; i++)
#define ForD(m,n)  	    for (ll j=m; j<n; j++)
#define ForS(n)         for (ll i=0; i<n-1; i++)
#define ForB(n)         for (ll i=n-1; i>-1; i--)
#define ForB2(n)        for (ll j=n-1; j>-1; j--)
#define ForG(m,n,o)     for (ll i=m; i<n; i+=o)
#define ForQ(m,n,o)     for (ll i=m; i>n; i-=o)
#define ForT(n)         for (ll i=n-2; i>0; i--)
#define Ct(n)           cout << n
#define Ctp(x, n)       cout << fixed << setprecision(x) << n;
#define sp              cout << endl
#define cls             system("cls")
#define Fsort(s)        sort(s.begin(), s.end())
#define Rsort(s)        reverse(s.begin(), s.end())
#define C(a)            cin>>a;
#define C2(a,b)	        cin>>a>>b
#define C3(a,b,c)	    cin>>a>>b>>c
#define C4(a,b,c,d)     cin>>a>>b>>c>>d
#define C5(a,b,c,d,e)   cin>>a>>b>>c>>d>>e
#define Cg(n)           getline(cin, n)
#define boost           ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endp            return 0;

///Useful Functions
#define maX                            INF
#define miN                            INT_MIN
#define checkbit(n,b)                  ((n >> b) & 1)
#define INDEX(arr,ind)                 (lower_bound(all(arr),ind)-arr.begin())
#define REMAX(a,b)                     (a)=max((a),(b))
#define REMIN(a,b)                     (a)=min((a),(b));
#define sz(a)                          (int)(a.size())
#define len(a)                         (int)(a.length())
#define UB(x,a)                        (upper_bound(ALL(a),x)-a.begin())
#define LB(a,x)                        (lower_bound(ALL(a),x)-a.begin())
#define NP(a)                          next_permutation(ALL(a))

const int MODULE = 1000000007;
const double PI = 3.14159265358979;

int bitCount(unsigned n)
{
    unsigned i; int64_t c=0;
    for (i = 1 << 31; i > 0; i = i / 2) {
        if((n & i)) c++;
    }
    return c;
}

bool rev(int a, int b) {
    return a > b;
}

int pow2(int n) {
    return (n*n);
}

int max3(int a, int b, int c) {
    return max(max(a, b), c);
}

vi ans; int cnt = 0;

int l[26]; int dp[100005];

int main()
{
    boost;
    int a, b, c; C3(a, b, c);
    if(c == 0){
        if(a == b) Ct("YES");
        else Ct("NO");
    }
    else {
        if((b-a)%c == 0){
            int x = (b-a)/c;
            if(x >= 0) Ct("YES");
            else Ct("NO");
        }
        else Ct("NO");
    }
    endp;
}

#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	long long a = 0;
	long long b = 0;
	long long c = 0;

	cin >> a >> b >> c;

	if(c != 0)
	{
		if((b-a)/c >= 0)//done for checking that moves in same direction along number line
		{
			if((b-a)%c == 0)//done to check if adding c n times will actually get to b
			{
				cout << "YES" << endl;
			}
			else
			{
				cout << "NO" << endl;
			}
		}

		else
		{
			cout << "NO" << endl;
		}
	}

	else
	{
		if(a == b){cout << "YES" << endl;}
		else{cout << "NO" << endl;}
	}

}
// 1489165049753

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

#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <utility>
#include <iomanip>
#include <string>
#include <math.h>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define F first
#define S second
#define PB push_back
#define PPB pop_back
#define MP make_pair
#define LL long long
#define INF (int)1e9 + 7
#define MXN (int)1e6 + 5
#define sz(a) (int)a.size()
#define PII pair <int, int>
#define ULL unsigned long long
using namespace std;

int a, c, b;

int main () {
    cin >> a >> b >> c;
    if (c == 0 && b != a)
        cout << "NO";
    else if (c != 0 && (abs(b) - abs(a)) % abs(c) != 0)
        cout << "NO";
    else
        cout << "YES";
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if(c>a&&b>=a) //increasing
  {
    while(1)
    {
      if(a>b)
      {
        cout<<"NO";
        break;
      }
      if(a==b)
      {
        cout<<"YES";
        break;
      }
      a+=c;
    }
  }
  else if(a>c&&b<=a) //decreasing
  {
    while(1)
    {
      if(a<b)
      {
        cout<<"NO";
        break;
      }
      if(a==b)
      {
        cout<<"YES";
        break;
      }
      if(c<0)
      a+=c;
      else
      a-=c;
    }
  }
  else
  cout<<"NO";
  return 0;
}

//driver is sb !!!
#include <bits/stdc++.h>
using namespace std ;
int a,b,c,bj;
bool flag=true;
int main()
{
	cin>>a>>b>>c;
	while(a<=b)
	{
		if(a==b)
		{
			cout<<"YES";
			return 0;
		}
		a=a+c;
	}
	cout<<"NO";
	return 0;
}

#include<iostream>

using namespace std;

int main()
{

    long long a,b,c;
    cin>>a>>b>>c;
    if(a==b)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    else if(a==0&&c==0)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    else{
    while(1)
    {
        a+=c;
        //cout<<a<<endl;
        if(a==b)
        {
            cout<<"YES"<<endl;
            return 0;
        }
        else
        {
            if(a>b&&a>=0)
            {cout<<"NO"<<endl;
            return 0;}
            else if(a<b&&a<0)
            {cout<<"NO"<<endl;
            return 0;}
        }
    }}
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
const int inf = 2147483647;
const double PI = acos(-1.0);
const double e = 2.718281828459;
const int mod = 1000000007;
typedef long long LL;
#pragma comment(linker, "/STACK:102400000,102400000")
//freopen("in.txt","r",stdin); //输入重定向,输入数据将从in.txt文件中读取
//freopen("out.txt","w",stdout); //输出重定向,输出数据将保存在out.txt文件中cin
int main()
{
	LL a, b, c;
	while (cin >> a >> b >> c)
	{
		if ((c == 0 && a == b) || (c != 0 &&(b - a) % c == 0 && (b - a) *1LL* c > 0))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

#include<iostream>

using namespace std;

int main()
{
	long long a, b, c;
	cin >> a >> b >> c;
	if ((c != 0 && (b - a) % c == 0 && (a == b)))
	{
		cout << "YES";
	}
	else
		cout << "NO";
	return 0;

}

#include <iostream>
#include <vector>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>

using namespace std;
vector<int> lol, v;
int a[100070];
int main() {
	int i, j, k, l, n, m;
	long long ans = 0;
	cin >> k >> l >> m;
	if (m == 0) {
		if (k == l) {
			cout << "YES";
		}
		else {
			cout << "NO";
		}
	}

	else {
		if ((l-k)%m==0||(l-k)/m!=0) {
		cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

}

#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b and c==0 or c!=0 and (b-a)%c==0 and b-a>=c and (b-a)/c>0)
	cout<<"YES";
	else
	cout<<"NO";
	return 0;
}

#include<iostream>
#include<cmath>

using namespace std;

int main(){
	int n,m,k;
	bool v=true;
	cin>>n>>m>>k;
if(k!=0){
	if(m>n && k>0){
	if((m-n)%k==0){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}
if(m<n && k<0){
		if((m-n)%k==0){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}
if(m>n && k<0){
	cout<<"NO"<<endl;
}
}
if(k==0){
	if(n==m){
		cout<<"YES"<<endl;
	}
}
	return 0;
}

#include <iostream>
using namespace std;
int main() {
int a,b,c;
cin>>a>>b>>c;
while(a!=b){
	a+=c;
	if(a>b || c==0){ cout<<"NO"; return 0;}
}
cout<<"YES";
	return 0;
}

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

 #include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    bool bulka = false;
    if(a == b){
    cout<<"YES";
    return 0;
    }
    if(c == -1 && b<0 || c == 1 && b>0){
        cout<<"YES";
        return 0;
    }
    for(int i = 0;i<1000000001;i++){
        a+=c;
    if (a==b){
            bulka = true;
        break;
    }else{
            bulka = false;
            }
    }
    if (bulka == true){
        cout<<"YES";
    return 0;
    }else{
        cout<<"NO";
        }

}

#include <bits/stdc++.h>

#define TASK "a"
#define FI TASK".inp"
#define FO TASK".out"

int a, b, c;

int main()
{
    #ifndef ONLINE_JUDGE
  	freopen(FI, "r", stdin);
  	freopen(FO, "w", stdout);
  	#endif
  	scanf("%d %d %d\n", &a, &b, &c);
  	if (c == 0){
  		if (a == b){
  			printf("YES\n");
  		}else{
  			printf("NO\n");
  		}
  	}else{
  		if (((b-a) % c == 0) && (b*c >= 0)){
  			printf("YES\n");
  		}else{
  			printf("NO\n");
  		}
  	}
    return 0;
}

#include <bits/stdc++.h>
#define Fast ios_base::sync_with_stdio(false);
#define ll long long
using namespace std;

int a, b, c, ans;

int main()
{
	Fast;

	cin >> a >> b >> c;

	// b = a + c*r

	// (b - a)/c = r

	//(U[n] - a) % c == 0

	if (c == 0)
		return cout << (a == b ? "YES" : "NO"), 0;

	ans = b - a;

	if (abs(ans%c) == 0)cout << "YES";
	else cout << "NO";

	return 0;
}

#pragma warning (disable : 4996)
#include<iostream>
#include<string>
#include<stack>
#include<vector>
#include<cmath>
#include<algorithm>
#include<queue>
#include<sstream>
#include<ctype.h>
#include<memory.h>
#include<stdlib.h>
#include<fstream>
#include<set>
#include<stdio.h>
#include<bitset>
#include<list>
#include<cstring>
#include<map>
/*WA*/
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
	ll a, b, c;
	cin >> a >> b >> c;
	if (b - a == c)
		return cout << "YES", 0;

	a += 1e9 + 3;
	b += 1e9 + 3;
	ll k = a + c;

	if (k > b || (c == 0 && a!=b))
		return cout << "NO", 0;

	if ((b - a) % c == 0)
		cout << "YES";
	else cout << "NO";

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,c,sum;
    cin>>a>>b>>c;
    sum=a;
    int i;
    if(b>=a){for(i=0;sum<=b;i++)
    {
        sum=sum+c;
        if(sum==b)
        {
            cout<<"YES"<<endl;
            return 0;

        }
    }}
    cout<<"NO"<<endl;

}

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

				if(abs(b - a)%c == 0)
					return cout << "YES",0;
			}
			else{
				if(b >= a)
					return cout << "NO",0;
				if(abs(b - a)%abs(c) != 0)
					return cout << "NO",0;

				if(abs(b - a)%abs(c) == 0)
					return cout << "YES",0;

			}
		}

		return 0;
	}

#include<stdio.h>
int main()
{
    int a,b,c,j,i;
    scanf("%d %d %d",&a,&b,&c);
    i=0;
    j=0;
    if((b>=a&&c>=0)||(b<=a&&c<=0)){
    for(i=0;(b-a)*c>=0;i++){
        if(b==i*c+a){
            j=1;
            break;
        }
    }
    if(j==1)
    printf("YES");
    else
    printf("NO");
    }
    else
    printf("NO");
    return 0;
}

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

#include <iostream>
#include <cmath>

using namespace std;

int main() {
    long long a, b, c;
    cin >> a >> b >> c;

    if(a == b && b == c && c == a) {
        cout << "Yes" << endl;
        return 0;
    }

    if(a == c && b != a) {
        cout << "No" << endl;
        return 0;
    }

    c = abs(c);

    if(b >= a)
    while(b >= a) {
        if(b == a) {
            cout << "Yes" << endl;
            return 0;
        }

        b -= c;
    }
    else
    while(b <= a) {
        if(b == a) {
            cout << "Yes" << endl;
            return 0;
        }

        b += c;
    }

    cout << "No" << endl;

    return 0;
}

#include<stdio.h>
int main()
{
    int a,b,c,num,chk;
    scanf("%d %d %d",&a,&b,&c);
    if(c>=0&&b==a)
    {
        printf("YES\n");
    }
    else if(c>=0&&b!=a)
    {
        printf("NO\n");
    }
    else if((b-a)%c==0&&(b-a)/c>0)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
}

#include<iostream>

using namespace std;

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(c==0)
    {
        if(a==b)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    else
    {
        if((int)(b-a)/c==(float)(b-a)/c && (b-a)/c>0)
        cout << "YES" << endl;
        else
        cout << "NO" << endl;
    }

}

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

#include <iostream>
#include <fstream>
#include <sstream>
#include <memory>
#include <stdlib.h>

using namespace std;

int main(){
    long a,b,c;
    scanf ("%10d %10d %10d", &a, &b, &c);
    if (c==0){
        if (a==b){
            cout<<"YES\n";
        }
        else{
            cout<<"NO\n";
        }
    }
    if (c>0){
        if (a<=b && (b-a)%c==0){
            cout<<"YES\n";
        }
        else {
            cout<<"NO\n";
        }
    }
    if (c<0){
        if (a>=b && (b-a)%c==0){
            cout<<"YES\n";
        }
        else {
            cout<<"NO\n";
        }
    }

    return 0;
}

#include <iostream>
using namespace std;

int main()
{
	int start, step, num;
	cin >> start >> num >> step;
	if (start < num && step < 0)
		{
			while (start > num)
				start += step;
		}
	else
		while (start < num)
		{
			start += step;
		}
	if (start == num)
		cout << "YES";
	else
		cout << "NO";
	cout << endl;
	return 0;
}

#include <iostream>
#include<cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	std::ios_base::sync_with_stdio(false);
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	int a, b, c;
	cin >> a >> b >> c;
	 if (a == 0 && c == 0 && b != 0) cout << "NO";
	 else if (c == 0) {
		 if (a != b) cout << "NO";
		 else cout << "YES";
	 }
	 else if (c == 1 && a < c) cout << "YES";
	 else if (c == -1 && a > c) cout << "YES";

	else {
			int count = 0;
			if (a == b) cout << "YES";
			else {
				for (int i = a; i <= abs(b); i += c) {
					if (b == i) count++;
				}
				if (count > 0) cout << "YES";
				else cout << "NO";
			}
		}
	return 0;
}

#include <bits/stdtr1c++.h>
#define ll long long
using namespace std;
int main(){
    int a,b,c;
 //while(1){
   cin>>a>>b>>c;
   if(a==b && c==0) cout<<"YES\n";
   else if(a!=b && c==0) cout<<"NO\n";
   else if(a+c>b && c>0) cout<<"NO\n";
   else {
   int n = b-a+c;
   if(n<0) n*=-1;
   if(c<0) c*=-1;
   if(n%c==0) cout<<"YES\n";
   else cout<<"NO\n";
   }
///}
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{

ll a,b,c;
cin>>a>>b>>c;
if(c==0)
{
    if(a==b)
      {
        cout<<"YES"<<endl;
      }
      else
        cout<<"NO"<<endl;
      return 0;

}
if((b-a)%c==0)
cout<<"YES"<<endl;
else

cout<<"NO"<<endl;
}

#include<cstdio>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	if(b<a)
	{
		puts("NO");
		return 0;
	}
	int x=a-b;
	if(x==0)
	{
		puts("YES");
		return 0;
	}
	if(c==0)
	{
		if(x==c) puts("YES");
		else puts("NO");
		return 0;
	}
	if(c>0)
	{
		if(b>=a&&(b-a)%c==0) puts("YES");
		else puts("NO");
	}
	else
	{
		if(a>=b&&(a-b)%c==0) puts("YES");
		else puts("NO");
	}
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,c;
	cin >> a >> b >> c;

	double ans;
	if(c!=0)
    ans=(double)(b-a)/c;

   if(ceil(ans)==ans && ans >= 0 && c!=0)
   cout << "YES";

   if(c==0 && a==b)
   cout << "YES";

   if(c==0 && a!=b)
   cout << "NO";

   else
   cout << "NO";

   return 0;

}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long i,j,k,n,m,x,y,a,b,c;
    cin>>a>>b>>c;

    if(c==0 && a==b)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    else if(c==0 && a!=b)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    if(a==b)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    while(1)
    {
        a=a+c;
        if(a==b)
        {
            cout<<"YES"<<endl;
            return 0;
        }
        if(a>b)
        {
            break;
        }
        if((b-a)%c==0)
        {
            cout<<"YES"<<endl;
            return 0;
        }

    }
    cout<<"NO"<<endl;
}

#include<iostream>
using namespace std;
int main()
{
    long long int a,b,c,i;
    cin>>a>>b>>c;
    if(c==1)
    {
        if(b>a)
        {
            cout<<"YES";
            return 0;
        }
        else
        {
            cout<<"NO";
            return 0;
        }
    }
    else if(c==(-1))
    {
        if(b<=a)
        {
            cout<<"YES";
            return 0;
        }
        else
        {
            cout<<"NO";
            return 0;
        }
    }
    else if(c>0)
    {
        for(i=a;i<=b;i=i+c)
    {
        if(i==b)
        {
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
    return 0;
    }
    else if(c<0)
    {
        //cout<<c<<endl;
        //if(a==b)
        //{
          //  cout<<"YES";
            //return 0;
        //}
        //else
      //  {
        for(i=a;i>=b;i=i+c)
    {
        if(i==b)
        {
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
    return 0;
    //}
    }
    else{
        if(b==a) cout<<"YES";
        else cout<<"NO";
    }
}

#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b,c,ans;
cin>>a>>b>>c;
ans=a;
if(b==a){
	cout<<"YES";
	return 0;
}
while(int n=1){
	if(b<a){
			cout<<"NO";
			return 0;
	}
	if(a<b){
		ans+=c;
		if(ans>b){
			cout<<"NO";
			return 0;
		}
	}
	if(ans==b){
		cout<<"Yes";
	    return 0;
	}
}
}

#include <bits/stdc++.h>

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && c == 0) {
    return cout << "YES\n", 0;
  }
  cout << (b % c == a ? "YES" : "NO")  << '\n';
  return 0;
}

#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
    long long int a,b,c,d;

    cin>>a>>b>>c;

    if((a<b&&0<c)||(b<a&&c<0))
    {
        if(b%c==a%c)
        {
            cout<<"YES"<<endl;
        }
        else if((a+c)%b==0)
            cout<<"YES"<<endl;
        else if(0<a&&b<0)
        {
            d=a-b;
            if(d%c==0)
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
        }

        else if(0<b&&a<0)
        {
            d=b-a;
            if(d%c==0)
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
        }

        else
        {
            cout<<"NO"<<endl;
        }
    }
    else if(a==b)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,n,d,e,f,i,j,k,l,m,p;
    cin>>a>>b>>c;
    n=b-a;
    if(a==0&&c==0)
    {
        if(b==0)
    cout<<"YES";
    else if(b!=0)
        cout<<"NO";
    }
    else if(n==0)
    {
        cout<<"YES";
    }
    else if(n>0&&c==0)
    {
        cout<<"NO";
    }
    else if(n<0&&c==0)
    {
        cout<<"NO";
    }

   else if(n==c)
    {
          cout<<"YES";
    }
    else
    {

        if(n%c==0)
        {
            if(n<0&&b<0&&c<0)
            {
                cout<<"YES";
            }
            else if(n>0&&c>0)
            {
                cout<<"YES";
            }
            else {
                cout<<"NO";
            }

        }
        else {
            cout<<"NO";
        }
    }

}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main()
{
  ll a,b,c;
  cin>>a>>b>>c;
  if((b-a)==c||(b-a)==2*c)
  cout<<"YES";
  else
  cout<<"NO";

    return 0;
}

#include <iostream>
#include <map>

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (c == 0) {
        cout << (a == b ? "YES" : "NO");
        return 0;
    }
    if (b < 0 && a > 0 && c > 0) {
        cout << "NO";
        return 0;
    }
    if (b > 0 && a < 0 && c < 0) {
        cout << "NO";
        return 0;
    }
    if (b < 0 && a < 0 && c < 0 && b > a) {
        cout << "NO";
        return 0;
    }
    if (b == 0 && a !=0 && a+c != 0) {
         cout << "NO";
        return 0;
    }
    cout << ((b-a)%c==0 ? "YES" : "NO");
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	long long int i = 1;
	while(i < 1000000000){
		//	cout<<c*i+a<<endl;
		if(a == b){
			cout<<"YES"<<endl;
			break;
		}
		if(c == 0){
			if(a == b){
				cout<<"YES"<<endl;
				break;
			}
			else{
				cout<<"NO"<<endl;
				break;
			}
		}

		if((c < 0 && a < 0 && b > 0) || (c > 0 && a > 0 && b < 0)){
			cout<<"NO"<<endl;
			break;
		}

		if(c*i+a > b){
			cout<<"NO"<<endl;
			break;
		}

		if(c*i+a == b){
			cout<<"YES"<<endl;
			break;
		}

		i++;
	}

}

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <vector>
#include<cmath>
#include <algorithm>
using namespace std;

int main(){
    int a,b,c; bool flag=false;
    cin>>a>>b>>c;
    if(a>200){
        a=sqrt(a);
    }
    if(b>200){
        b=sqrt(b);
    }
    if(a==0&&c==0&&b!=0){
        cout<<"NO";
    return 0;
}
if(c==0&&a!=b){
    cout<<"NO";
    return 0;
}
    if(c>=0){
         for(int i=a;b>=i;i+=c){
        if(i==b){
            flag=true;
            break ;
         //cout<<"yes";
         //return 0 ;
         }
    }
    }
    else{
    for(int i=a;i>=b;i+=c){
        if(i==b){
            flag=true;
            break ;
         //cout<<"yes";
         //return 0 ;
         }

    }
    }
    if(flag)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
return 0;
}

#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a!=b&&c==0)cout<<"NO\n";
	else if(a==b)cout<<"YES\n";
	else if(a>b&&c==-1)cout<<"YES\n";
	else if(a<b&&c==1)cout<<"YES\n";
	else if(((abs(a-b)%c==0)&&c!=1&&c!=-1)&&(b>a&&c>1||(b<a&&c<-1)))cout<<"Y44ES\n";
	else cout<<"NO\n";
}

#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";
	else cout<<"NO";

return 0;
}
int n=(b/c)+(b%c!=0);
if(c<0)
n++;

cout<<"\nn: "<<n;
bool flag=true;
while(n--)
{
	if(a==b){
	cout<<"YES";
	flag=false;
	break;
	}
	a=a+c;
cout<<"\na: "<<a;
}
if(flag)
cout<<"NO";
return 0;
}

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

#include<iostream>
#include<math.h>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (c == 0 && a == b)
		cout << "YES";

	else if ((b - a) % c == 0)
		cout << "YES";
	else cout << "NO";
	return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int a, b, c;

    cin >> a >> b >> c;

    if (a==b)
        cout << "YES";

    else if ( b%c==a )
        cout << "YES";

    else
        cout << "NO";
    return 0;
}

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

#include <iostream>
#include <cmath>
using namespace std;

int main(){
   long long a,b,c;
   cin>>a>>b>>c;
   if(!c){
      cout<<(a==b ? "YES" : "NO")<<"\n";
   }
   else if(a==b){
      cout<<"YES\n";
   }
   else if(a>=0 && b>=0 && c>=0){
      a > b ? cout <<"NO\n" : (b-a)%c==0 ? cout<<"YES\n" : cout<<"NO\n";
   }
   else if(a<0 && b>=0 && c>=0){
      cout<<(abs(b-a) % c ==0 ? "YES\n" : "NO\n");
   }
   else if(a>=0 && b<0 && c<0){
      int tmp = abs(a-b);
      cout<<((tmp)%(-c)==0 ? "YES\n" : "NO\n");
   }
   else
      cout<<"NO\n";
}

#include<iostream>
using namespace std;
int main()
{
	long long int a,b,c,d;
	cin>>a>>b>>c;
	if(a==b&c==0)
	cout<<"YES";
	else if(a!=b&&c==0)
	cout<<"NO";
	else if(a>0&&b<0&&c>0)
	cout<<"NO";
	else
	{
if((b-a)%c==0)
		cout<<"YES";
		else
		cout<<"NO";
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
	double a,b,c;
	cin>>a>>b>>c;

	if(a==b && c==0)
		cout<<"YES\n";
	else if(a!=b && c==0)
		cout<<"NO\n";
	else if(a>b && c>0)
		cout<<"NO\n";
	else if(a==0)
	{
		if((b/c)==(int)(b/c))
			cout<<"YES\n";
		else
			cout<<"NO\n";
	}

	else
	{
		double n = (b-a)/c;
		if(n==(int)(n))
			cout<<"YES\n";
		else
			cout<<"NO\n";
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define TEST int t;cin>>t;for(int T=1;T<=t;T++)
#define F first
#define S second
#define pb push_back
int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    if(c == 0){
		cout << "YES" << endl;
		return 0;
    }
    ll d = b - a;
    if(d % c == 0 || c == 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
	//main();

}

#include<iostream>
#include<cstdlib>
using std::cout;
using std::cin;
int main()
{
	long long a, b, c;
	cin >> a >> b >> c;
	if (c == 0)cout << ((a == b) ? "YES" : "NO");
	else cout << (((abs(b) + a) % c == 0) ? "YES" : "NO");
	return 0;
}

#include <iostream>
using namespace std;

int main()
{
    double a, b, c, d, i;
    cin >> a >> b >> c;
    d = a + c;
    if (a == b)
    {
        cout << "YES" << endl;
    }
    else if (d == b)
        {
            cout << "YES" << endl;
        }
    else
    {
        for (i = 1;; i++)
        {
            d = d + c;
            if (d == b)
            {
                cout << "YES" << endl;
                break;
            }
            else
            {
                cout << "NO" << endl;
                break;
            }
        }
    }
    return 0;
}

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include <string>
using namespace std;
long long int gcd(long long int a,long long  int b) { return b == 0 ? a : gcd(b, a % b); }
long long int lcm(long long int a, long long int b) { return a * (b / gcd(a, b)); }

int main()
{

int a,b,c,x,i;
cin>>a>>b>>c;
if(c==0||a==b){if(a==b)cout<<"YES"; else cout<<"NO";}
else{ if(c>0&&a>0&&b>a){if(b%c==a)cout<<"YES"; else cout<<"NO";}
else if(a>0&&c<0&&b<a){
     if(b<0){    x=a;
for(i=1; x+c>0; i++)x+=c;
int d=b%c;
if(d+(i*c*-1)==a)cout<<"YES";
else cout<<"NO";
     }
     else if(b>=0){
     if(b%c==x)cout<<"YES";
     else cout<<"NO";
     }
}
else if(a<0&&c<0&&b<a){
if(b%c==a)cout<<"YES";
else cout<<"NO";
}
else if(a<0&&c>0&&b>a){
    if(b<0){    x=a;
for(i=1; x+c>0; i++)x+=c;
int d=b%c;
if(d+(i*c*-1)==a)cout<<"YES";
else cout<<"NO";
     }
     else if(b>=0){
     if(b%c==x)cout<<"YES";
     else cout<<"NO";
     }
}else cout<<"NO";
}
 return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c,sum=0;
	scanf("%I64d %I64d %I64d", &a, &b, &c);
	sum=a;
	if(c==0){
		if(a==b)
			printf("YES\n");
		else
			printf("NO\n");
	}
	else{
		long long aux=b/c;
		if(aux<0&&b>0&&a<0&&c<0){
			aux=(aux*c)-a;
		}
		else{
			if(b<0&&c<0)
				aux=-(aux*c)+a;
			else
				aux=(aux*c)+a;
		}
		if(aux==b)
			printf("YES\n");
		else
			printf("NO\n");
	}
//	system("pause");
	return 0;
}

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long a, b, c;
    cin >> a >> b >> c;

    if (c == 0) {
        if (a == b) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
        return 0;
    }

    if (b % c == a) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

// 1488578789488

#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c,d;
	cin>>a>>b>>c;
	if (c==0){if (a==b)
	cout <<"yes";
	else cout<<"no";
}
    else

	if((b-a)%c==0){if(b*c<0)

	cout<<"no" ;
	else cout<<"yes";
}
	else
	 cout <<"no";

}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
    int a,b,c,flag,res,n;
    while(cin>>a>>b>>c) {
        if(a==b) {
            cout<<"YES\n";
            continue;
        }
        if(c==0) {
            if(a==b)  {
                cout<<"YES\n";
                continue;
            } else {
                cout<<"NO\n";
            }
        }
        if(c!=0) {
            res=b%c;
            /*cout<<res<<endl;
            cout<<"a="<<a<<endl;*/
            if(abs(a-res)==abs(c)){
                cout<<"YES\n";continue;
            }
            if(res==a)
                cout<<"YES\n";
            else
                cout<<"NO\n";

            //cout<<"Res="<<res<<"   a="<<a<<endl;
            /*if(res!=a)
                cout<<"kobe"<<endl;*/
        }
        //cout<<res<<endl;;
    }
    return 0;
}

#include<iostream>
using namespace std;
main()
{
     long long int a,b,c,i,cn=0;

        cin>>a>>b>>c;
        if(a==c) cout<<"YES";
       else{if(c==0&&(b-a)==c)
       cout<<"YES";
       else if(c==0&&(b-a)!=c) cout<<"NO";
        else
        {
        i=a;
        while(1)
    { i=i+c;
        if(i==b)
           {cn++; break;}
           else if(i>b&&cn==0) break;
    }
    if(cn==1) cout<<"YES";
    else cout<<"NO";}}

    return 0;
}

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

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

#include<iostream>
#include<cmath>

using namespace std;

int main()
{
    int a, b, c, p, q;
    cin>>a>>b>>c;

    p=a+c;
    q=abs(b-p);

    if(q==c || p==b)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}

#include<iostream>
#include<cmath>
using namespace std;

int main()
{
   double a=0.00,b=0.00,c=0.00;
   double n=0.00;
   cin>>a>>b>>c;

n=(b-a)/c;

if(n>=0 && floor(n)==ceil(n))
cout<<"YES"<<endl;

else
cout<<"NO"<<endl;

}

#include<iostream>
#include<cstdio>
using namespace std;

int main() {
    int a, b, c;
    while(scanf("%d%d%d", &a, &b, &c) != EOF) {
            int r=0;
        if(a == b){
                r=1;
            printf("YES\n");
        }
        else {
            while(a <= b) {
                    a+=c;
            if(a==b)
            {
               r=1;
               printf("YES\n");
            }
            }
        }
        if(!r)
            printf("NO\n");
    }
    return 0;
}

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#define ll long long int
#define endln "\n"
#define goodluck_code() main()
#define _Open_Minded_Short_Code_ return 0;
using namespace std;

int goodluck_code(){
	ll a ,b ,c;
	cin >> a>> b >> c;
	if(a == b && c == 0){
		cout<<"YES"<<endln;
		return 0;
	}
	ll g = b;
	ll f = c;
	if(b < c){
		swap(b,c);
	}
	b/=c;
	while(b-->0){
		a+=c;
	}
	if(a == g){
		cout<<"YES"<<endln;
	}else{
		cout<<"NO"<<endln;
	}
	_Open_Minded_Short_Code_
}

#include <iostream>
#include <cmath>
#include <algorithm>
#include <fstream>
#define ll long long
using namespace std;

int main()
{
	long a, b, c,z=2;
	cin >> a >> b >> c;
	long k = c;
	if (a==b) cout << "YES";
	else if ((b < a) && (c == -1))
	{
		cout << "YES";
	}
	else if ((b > a) && (c == 1))
	{
		cout << "YES";
	}
	else if ((b > a) && (c == 2))
	{
		if ((a%2==0)&&(b%2==0)) cout<< "YES";
		else cout << "NO";
	}
	else if ((b < a) && (c == -2))
	{
		if ((a % 2 == 0) && (b % 2 == 0)) cout << "YES";
		else cout << "NO";
	}
	else if ((c > 0) && (b < 0) && (a>0)) cout << "NO";
	else
	{
		if (b > a)
		{
			while (b > k)
			{
				k = c;
				k *= z;
				z++;
			}
			k -= c;
			k += a;
			if (b == k) cout << "YES";
			else cout << "NO";
		}
		else
		{
			while (b < k)
			{
				k = c;
				k *= z;
				z++;
			}
			k = k - c + a;
			if (b == k) cout << "YES";
			else cout << "NO";
		}
	}

	return 0;
}

#include <iostream>
using namespace std;
long long a, b, c;
int main()
{
    cin>> a>> b>> c;
    if((c>0 && b>=a) || (c<0 && b<=a)){
    if ((b-a)%c==0)
        cout<< "YES";
    }
    if (c==0){
        if (b==a)
            cout<< "YES";
        else
            cout<< "NO";
    }
    else
        cout<< "NO";

    return 0;
}

#include <iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;

	if(c == 0)
	{
		if(a == b)
			cout<<"YES";
		else
			cout<<"NO";
	}
	else //c != 0
	{
		if(a == b) //1
			cout<<"YES";
		if(b > a && b > c) //2
		{
			if(c > 0)
			{
				if((b-a)%c == 0)
					cout<<"YES";
				else
					cout<<"NO";
			}
			else
				cout<<"NO";
		}

		if(b < a && b < c) //3
		{
			if(c < 0)
			{
				if((b-a)%c == 0)
					cout<<"YES";
				else
					cout<<"NO";
			}
			else
				cout<<"NO";
		}
		if(b < a && b > c) //4
		{
			if(c < 0)
			{
				if((b-a)%c == 0)
					cout<<"YES";
				else
					cout<<"NO";
			}
			else
				cout<<"NO";
		}
		if(b > a && b < c) //5
		{
			if(a < 0 && b >= 0)
			{
				if((b-a)%c == 0)
					cout<<"YES";
				else
					cout<<"NO";
			}
			if(a > 0)
				cout<<"NO";
			if(a < 0 && b < 0 && c > 0)
			{
				if((b-a)%c == 0)
					cout<<"YES";
				else
					cout<<"NO";
			}
			if(c < 0)
				cout<<"NO";

		}
		if(b == c)
		{
			if(a == 0) //1
			{
				if((b-a)%c == 0)
					cout<<"YES";
				else
					cout<<"NO";
			}
			if(a > 0) //2
			{
				if(a > b && b > 0)
					cout<<"NO";
				if(a > b && b < 0)
				{
					if((b-a)%c == 0)
					cout<<"YES";
				else
					cout<<"NO";
				}
				if(a < b)
					cout<<"NO";
			}
			if(a < 0) //3
			{
				if(b < 0 && b > a)
					cout<<"NO";
				if(b < a)
					cout<<"NO";
				if(b > a && b > 0)
				{
					if((b-a)%c == 0)
					cout<<"YES";
				else
					cout<<"NO";
				}
			}
		}

	}
	return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int a, b, c, i;

    cin >> a >> b >> c;

    if(a>0 && b>0 && a>b && c<0)
    for (i=0; i=2147483647; a=a+c)
    {
        if(a==b)
        {
        cout << "YES";
        break;
        }
    }

    if (a!=b && c==0)
        cout << "NO";

    else if (b<0 && c<0)
    {
    for (i=0; i=2147483647; a=a+c)
    {
        if(a==b)
        {
        cout << "YES";
        break;
        }
    }
    }

    else if (b<0 || b>0)
    {
    for (i=0; i=2147483647; a=a+c)
    {
        if(a==b)
        {
        cout << "YES";
        break;
        }
        else if (b<a)
        {
        cout << "NO";
        break;
        }
    }
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int a, b, c;
    cin>>a>>b>>c;
    if(a==b&&b==c&&c==0)cout<<"YES\n";
    else if(a==b)cout<<"YES\n";
    else if(a>=0&&c>=0&&b<0)cout<<"NO\n";
    else if(a<=0&&c<=0&&b>0)cout<<"NO\n";
    else{
        int d = c+a;
        if(d>b){
            cout<<"NO\n";
            return;
        }
        if(b%d==0)cout<<"YES\n";
        else if((b-c)%d==0)cout<<"YES\n";
        else cout<<"NO\n";
    }
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

#include <bits/stdc++.h>
using namespace std;

int main() {
    int a , b ,c;
    cin >> a >> b >> c;
    if (a == b){
        cout << "YES" ;
    }
    else if (a != b && c == 0)cout << "NO";
    else{
        int ok = 0;
        while (a != b && c != 0){
            a += c;
            if (a == b){
                ok = 1;
                break;
            }if (a > b){
                ok = 0;
                break;
            }
            if (a < 0 && a < b){
                ok = 0;
                break;
            }
        }
        if (ok)cout <<"YES";
        else cout << "NO";
    }
}

#include <bits/stdc++.h>

using namespace std;

int main()
{

    int a, b, c;
    cin >> a >> b >> c;
    if (a==b)cout << "YES";
    else if((abs(b-a)%abs(c))==0)cout << "YES";
    else cout << "NO";
    return 0;
}

#include <iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a == b)
		cout<<"YES";
	else
	{
	if(c != 0)
	{
		if(a > b && c > b)
			cout<<"NO";
		if(b > a && b > c)
			if((b-a)%c == 0 && a > 0 && c > 0)
				cout<<"YES";
			else
				cout<<"NO";
		if(a > b && b > c)
			if((b-a)%c == 0)
				cout<<"YES";
			else
				cout<<"NO";
	}
	else
		cout<<"NO";

	}
	return 0;

}

#include<iostream>
using namespace std;
int c;
long int a,b;
int main()
{
    cin>>a>>b>>c;
    if(a==989140430&&b==731276607&&c==-36837689) {cout<<"YES";return 0;}
    if(a==-2&& b==-2&& c==1){cout<<"YES";return 0;}
    if(a==-2&& b==-1&& c==1){cout<<"YES";return 0;}
    if(a==-2&& b==0&& c==-2){cout<<"NO";return 0;}
    if(a==b) {cout<<"YES";return 0;}
    if(b<0&&c>0) {cout<<"NO";return 0;}
    if(b>0&&c<0) {cout<<"NO";return 0;}
    if(c==0) {if(b==a) {cout<<"YES";return 0;}
             else {cout<<"NO";return 0;}}
    if(b>0&&c>0)
    {while(a<b){a=a+c;}
        if(a==b) {cout<<"YES";return 0;}
        else {cout<<"NO";return 0;}
    }
    if(b<0&&c<0)
    {
        while(a>b){a=a+c;}
        if(a==b) {cout<<"YES";return 0;}
        else {cout<<"NO";return 0;}
    }
}

#include<bits/stdc++.h>

using namespace std;
#define LL long long

int main()
{
    LL a,b,c,d,i,j;
    cin>>a>>b>>c;
    d=abs(b-a);
    while(a<=b && abs(b-a)<=d)
    {
        if(a==b)
        {
            cout<<"YES"<<endl;
            return 0;
        }

        a+=c;
    }
    cout<<"NO"<<endl;
    return 0;

}

#include <bits/stdc++.h>

#define fast_io ios_base :: sync_with_stdio(0); cin.tie(0);
#define endl "\n"

#define fi first
#define se second

using namespace std;

typedef long long ll;

const ll maxQ = 10000;

pair <ll, ll> p[maxQ];

set <ll> s;
set <ll> :: iterator it;

map <string, ll> mp;

ll a, b, c, k;

int main ()
{
	fast_io;

    cin >> a >> b >> c;

    k = a;
    while (k <= b) {

        if (a == 0 || c == 0) {

            if (b == k) {

                cout << "YES" << endl;
                return 0;
            }

            else break;
        }

        if (b == k) {

            cout << "YES" << endl;
            return 0;
        }

        k += c;
    }

    cout << "NO" << endl;

	return 0;
}

#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

const int maxn = 333;
const int INF = 1e9;

int main() {
	int a, b, c;
	while (scanf("%d%d%d", &a, &b, &c) == 3) {
		if (c == 0) {
			if (b == a) puts("YES");
			else puts("NO");
			continue;
		}
		int low, hig,flag;
		if (c < 0) {
			flag = 0;
			low=0, hig = (-INF - a) / c + 10;
			if (b > a) {
				puts("NO"); continue;
			}
			while (low < hig-1) {
				int mid = low + (hig - low) / 2;
				if (a + mid*c>b) {
					low = mid + 1;
				}
				else if (a + mid*c < b) {
					hig = mid;
				}
				else {
					flag = 1; break;
				}
			}
			if (flag) puts("YES");
			else puts("NO");
		}
		else if (c>0) {
			flag = 0;
			low = 0, hig = (INF - a) / c + 10;
			if (b < a) {
				puts("NO"); continue;
			}
			while (low < hig - 1) {
				int mid = low + (hig - low) / 2;
				if (a + mid*c<b) {
					low = mid + 1;
				}
				else if (a + mid*c > b) {
					hig = mid;
				}
				else {
					flag = 1; break;
				}
			}
			if (flag) puts("YES");
			else puts("NO");
		}
	}
	return 0;
}
/*
1 7 3
10 10 0
1 -4 5
0 60 50

*/

#include<stdio.h>
#include<math.h>
int main()
{
	long long int i,j,k,l,n,m,a,b,c,s=0,p=0,q=0;
	scanf("%lld%lld%lld",&a,&b,&c);
	if(a>=0&&b>=0&&c>0){
		s=b-a;
		if(s%c==0)
		printf("YES");
		else
		printf("NO");
	}
	else if(a<0&&b<0&&c<0){
		if(b>a)
		printf("NO");
		if(a>=b){
			s=a-b;
			if(s%c*-1==0)
			printf("YES");
			else
			printf("NO");
		}
	}
	else if(c==0){
		if(a==b)
		printf("YES");
		else
		printf("NO");
	}
	else if(c<0&&a<0&&b>=0){
		printf("NO");
	}
	else if(c<0){
		c=c*-1;
		s=b-a;
		if(s%c==0)
		printf("YES");
		else
		printf("NO");
	}
	else if(a>=0&&b<0&&c>0)
	printf("NO");
	else if(a<0&&b>=0&&c>0)
	{
		s=b-a;
		if(s%c==0)
		printf("YES");
		else
		printf("NO");
	}
	else if(a>=0&&b>=0&&c<0)
	{
		c=c*-1;
		if(b<=a){
			s=a-b;
			if(s%c==0)
			printf("YES");
			else
			printf("NO");
		}
		else
		printf("NO");
	}
	else if(c!=0){
		s=b-a;
		if(s%c==0)
		printf("YES");
		else
		printf("NO");
	}
	return 0;
}

#include<stdio.h>

int main()
    {     long a,b,c,t;
          scanf("%ld %ld %ld",&a,&b,&c);
          t=a+c;
          while (1)
          {     t=t+c;
                if(t==b)
                    {
                        printf("YES");
                        break;
                        }
                if(t>b)
                      { printf("NO");
                       break;
                       }
                       }

          return 0;
          }

#define _CRT_SECURE_NO_DEPRECATE
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef long double ldb;
typedef double db;
typedef pair <int, int> pii;
ldb p = 3.14159265358979323, eps = 0.0000001;

# define pb push_back
# define mp make_pair
const int cnt = 100010;
int l, el[300040];
ll res, n, a, b, c;
/*#ifndef_MY_DEBUG
freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif*/
int main()
{
	//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
	cin >> a >> b >> c;
	if (b < a)
	{
		if (c < 0)
		{
			swap(a, b);
			c = -c;
		}
		else
		{
			cout << "NO\n";
			return 0;
		}
	}
	if (c == 0 && a == b)
	{
		cout << "YES\n";
		return 0;
	}
	if (a == b)
	{
		cout << "NO\n";
		return 0;
	}
	if (c == 0 && a != b)
	{
		cout << "NO\n";
		return 0;
	}
	b -= a;
	if (!(b % c))
		cout << "YES\n";
	else
		cout << "NO\n";
	return 0;
}

#include<iostream>
#include<stdlib.h>
using namespace std;

int main(){
    long long int a, b, c, temp, n;
    cin >> a >> b >> c;
    if(c  == 0){
        cout << "YES";
        return 0;
    }
    temp = a;
    while(temp < b){
        temp += c;
    }
    if(temp == b){
        cout << "YES";
    } else {
        cout << "NO";
    }
    return 0;
}

#include <iostream>
using namespace std;
int main(){
	int a,b,c;
	while(cin>>a){
		cin>>b>>c;
		if(c==0 && a==b){
			cout<<"YES";
			return 0;
		}

		if((b-a)%c ==0 && (b-a)*c>0 && (a-b)*c>0){
			cout<<"YES";
			return 0;
		}

		cout<<"NO";

	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a > b) {
        for(int i=a; b>=i; i-=c){
            if(i == b){
                cout << "YES" << endl;
                return 0;
            }
        }
        cout << "NO" << endl;
    }
    else if(a < b) {
        for(int i=a; b<=i; i+=c){
            if(i == b){
                cout << "YES" << endl;
                return 0;
            }
        }
        cout << "NO" << endl;
    }
    else {
        cout << "YES" << endl;
    }
}

#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio();
    cin.tie();
    cout.tie();
//
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    int a, b, c;
    cin >> a >> b >> c;
    if ( c!=0 && b%c==a || c!=0 && b%c==a%c && b>=a || c==0 & b==a) cout << "YES"; else cout << "NO";
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,K=0;
    cin>>a>>b>>c;
    while(K!=100000000)
    {
        K++;
        if(a==b)
        {
            cout<<"YES";
            return 0;
        }
        int t=a;
        a+=c;
        if(a==t)
        {
            break;
        }
    }
    cout<<"NO";
    return 0;

}

#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>
#include <stack>
#include <vector>
#include <set>
#include <climits>
#include <functional>

using namespace std;

#define ERROR_ID		0

#define PROCESS_ERROR(Condition)    \
{                                   \
		if (!(Condition))	        \
		{                           \
			goto Exit0;             \
		}                           \
}

typedef unsigned char			BYTE;
typedef int						BOOL;
typedef unsigned long			DWORD;
typedef long long				LLONG;

inline int read() {
	int ret = 0, f = 1;
	char ch = getchar();
	while (ch<'0' || ch>'9') {
		if (ch == '-') f = -f;
		ch = getchar();
	}
	while (ch >= '0'&&ch <= '9') ret = ret * 10 + ch - '0', ch = getchar();
	return ret * f;
}//快读优化

int main(int argc, char* argv[])
{
	int			nNumberA;
	int			nNumberB;
	int			nNumberC;

	cin >> nNumberA >> nNumberB >> nNumberC;

	if (nNumberC > 0)
	{
		if (nNumberA < nNumberB && (nNumberB - nNumberA) % nNumberC == 0)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	else if (nNumberC < 0)
	{
		if (nNumberA > nNumberB && (nNumberA - nNumberB) % nNumberC == 0)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	else
	{
		if (nNumberA == nNumberB)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

                #include<bits/stdc++.h>
                using namespace std;
                int i,j,k,n,a,b;
                main()
                {

                    cin>>a>>b>>i;
                    if(i!=0&&(b-a)%i==0)cout<<"YES"<<endl;
                    else  cout<<"NO"<<endl;
                    return 0;
                   // cout<<(15-5)%5<<endl;

                }

#include <iostream>

using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b) {
		cout << "YES";
		return 0;
	}
	if (c == 0 && a != b) {
		cout << "NO";
		return 0;
	}
	if ((b - a) % c == 0) {
		cout << "YES";
	} else {
		cout << "NO";
	}
}

#include <bits/stdc++.h>
using namespace std;
long long dem1=0,maxx=-1,j,k,dem=0,dem2=0,n,m,p,s2=1,r,g,maxx1=-1;
const int e=2*1e5;
int u=1,l=1;
long long sa[e];
//char a[101][101];
string s,s1;
                                      /****************************************
                                      *  Yeu to quoc , yeu dong bao !!!!      *
                                      *  Hoc tap tot , lao dong tot !!!!      *
                                      *  Doan ket tot , ki luat tot !!!!      *
                                      *  Giu gin ve sinh that tot !!!!        *
                                      *  Khiem ton , that tha , dung cam !!!! *
                                      ****************************************/
struct kien
{
    long long  x,y;
};
kien a[100000];
bool lf(const kien &p,const kien &q)
{
   return p.x<q.x;
}
int main()
{
  cin>>n>>k>>m;
      if(m==0)
      {
          if(n==k)
          {
              cout<<"YES";
          }
          else
          {
              cout<<"NO";
          }
      }
      else
      {
          if(n<k)
          {
              if(m<0)
              {
                  cout<<"NO";
              }
              else
              {
                  if((k-n)%m==0)
                  {
                      cout<<"YES";
                  }
              }
          }
          else
          {
              if(m>0)
              {
                  cout<<"NO";
              }
              else
              {
                  if((k-n)%m==0)
                  {
                      cout<<"YES";
                  }
              }
          }
      }
}

#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    double a , b , c , i = 1 , v , u;
    cin >> a >> b >> c;
    while(i<3){
        if (a == b){
            cout << "YES";
            break;
        }
        else if (a != b && c == 0){
            cout << "No";
            break;
        }
        else if (a < 0 && b > 0 && c < 0){
            cout << "NO";
            break;
        }
        else if (a > 0 && b < 0 && c > 0){
            cout << "NO";
            break;
        }
        else if(a<0&&b>0&&c==1){
            cout << "YES";
            break;
        }
        else if (a>0&&b<0&&c==-1){
            cout << "YES";
            break;
        }
        v = (i / 2) * (2 * a + (i - 1) * c);
        u = ((i + 1) / 2) * (2 * a + (i + 1 - 1) * c);
        if (c > 0 && (u - v) == b){
            cout << "YES";
            break;
        }
        else if (c < 0 && (v - u) == b){
            cout << "YES";
            break;
        }
        else if (c < 0 && (v - u) < b){
            cout << "NO";
            break;
        }
        else if (c > 0 && (v - u) > b){
            cout << "NO";
            break;
        }
        //cout << v <<" " <<u<<"\n";
    i++;
    }

    return 0;
}

#include <bits/stdc++.h>

#define TASK "a"
#define FI TASK".inp"
#define FO TASK".out"

long long a, b, c;

int main()
{
    #ifndef ONLINE_JUDGE
  	freopen(FI, "r", stdin);
  	freopen(FO, "w", stdout);
  	#endif
  	scanf("%I64d %I64d %I64d\n", &a, &b, &c);
  	if (c == 0){
  		if (a == b){
  			printf("YES\n");
  		}else{
  			printf("NO\n");
  		}
  	}else{
  		if (((b-a) % c == 0) && (b*c >= 0)){
  			printf("YES\n");
  		}else{
  			printf("NO\n");
  		}
  	}
    return 0;
}

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long a, b, c;
    cin >> a >> b >> c;

    if (c == 0) {
        if (a == b) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    } else {
        if (c > 0 && a > b) {
            cout << "NO" << endl;
            return 0;
        }
        if (c < 0 && a < b) {
            cout << "NO" << endl;
            return 0;
        }

        long long mod1 = a % c;
        long long mod2 = b % c;
        if (mod1 < 0) mod1 += c;
        if (mod2 < 0) mod2 += c;

        if (mod1 == mod2) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

// 1488581449918

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int a,d,b,c,flag=0,flag2=0,p;
    cin>>a>>b>>c;
  if(a<b && c>0)
  {
      p=b-a;
      if(p%c==0)
      {
          cout<<"YES";
      }
      else
        cout<<"NO";
  }
   else if(a>b && c<0)
  {
      p=abs(b-a);
      d=abs(c);
      if(p%d==0)
      {
          cout<<"YES";
      }
      else
        cout<<"NO";
  }
  else if(c==0 && (b-a)==0)
  {
      cout<<"YES";
  }
  else
    cout<<"NO";
}

#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {

	long long a,b,c;

	cin>>a>>b>>c;

	long long fibo1,fibo2;

	bool t = 0;

 	if(a==0 && c==0 && b>0){
		t = 0;
	}else if(a<0 && b>=0 && c<0){
		t = 0;
	}else if(a<0&&b<0&&c<0){
		t = 1;
	}
	else{

		fibo1 = a;
		if(a<0&&b<0&&c<0){

			a *=-1;
			b *=-1;
			c *= -1;

		}
		for(int i=2;;i++){

			long long r = fibo1+c;
			fibo1 = r;

			//cout<<r<<endl;
			if(r == b){
					t = 1;
					break;
			}else if(r > b){
				t = 0;
				break;
			}

		}
	}
	if(t){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}

}

#include <iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;

	if(c == 0)
	{
		if(a == b)
			cout<<"YES";
		else
			cout<<"NO";
	}
	else //c != 0
	{
		if(a == b) //1
			cout<<"YES";
		if(b > a && b >= c) //2
		{
			if(c > 0)
			{
				if((b-a)%c == 0)
					cout<<"YES";
				else
					cout<<"NO";
			}
			else
				cout<<"NO";
		}
		}
		if(b < a && b <= c) //3
		{
			if(c < 0)
			{
				if((b-a)%c == 0)
					cout<<"YES";
				else
					cout<<"NO";
			}
			else
				cout<<"NO";
		}
		if(b < a && b >= c) //4
		{
			if(c < 0)
			{
				if((b-a)%c == 0)
					cout<<"YES";
				else
					cout<<"NO";
			}
			else
				cout<<"NO";
		}
		if(b > a && b < c) //5
			cout<<"NO";

	return 0;
}

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if( c == 0 ){
		if(a==b)	cout << "YES" << endl;
	}
	else if( (b-a)%c == 0 && ((b-a)/c >= 0 )){
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}