#include <bits/stdc++.h>
using namespace std;
int main() {
  int n[9], Sn, N;
  for (int i = 0; i < 9; i++) cin >> n[i];
  Sn = n[0] + n[1] + n[2] + n[3] + n[4] + n[5] + n[6] + n[7] + n[8];
  N = n[0] * 100000000 + n[1] * 10000000 + n[2] * 1000000 + n[3] * 100000 +
      n[4] * 10000 + n[5] * 1000 + n[6] * 100 + n[7] * 10 + n[8];
  if (N % Sn == 0)
    cout << "Yes";
  else
    cout << "NO";
}
