#include <bits/stdc++.h>
using namespace std;
int main() {
  int i = 0, c1, c2, c3, c4, a[6];
  while (i < 6) cin >> a[i++];
  c1 = a[5] * a[1] - a[2] * a[4];
  c2 = a[4] * a[0] - a[3] * a[1];
  c3 = a[0] * a[5] - a[2] * a[3];
  c4 = a[1] * a[3] - a[0] * a[4];
  if ((!a[0] && !a[1] && a[2]) || (!a[3] && !a[4] && a[5]))
    cout << "0";
  else if (c2 == 0 && c4 == c2 && c2 == c1 && c3 == 0)
    cout << "-1";
  else if (c2 && c4)
    cout << "1";
  else
    cout << "0";
  return 0;
}
