#include <bits/stdc++.h>
int main() {
  float x, y, z, a1, b1, c1, a2, b2, c2;
  scanf("%f %f %f", &a1, &b1, &c1);
  scanf("%f %f %f", &a2, &b2, &c2);
  x = b2 * c1 - c2 * b1;
  y = a1 * c2 - a2 * c1;
  z = a1 * b2 - a2 * b1;
  if (x == 0 && y == 0 && z == 0) {
    if ((a1 == 0 && b1 == 0) && (a2 == 0 && b2 == 0) && (c1 != 0 || c2 != 0)) {
      printf("0");
      return 0;
    }
    printf("-1");
  } else if (z != 0) {
    printf("1");
  } else {
    printf("0");
  }
  return 0;
}
