#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long int repow(long long int n, long long int k, long long int m) {
  if (k == 0)
    return 1;
  else if (k % 2 == 1)
    return repow(n, k - 1, m) * n % m;
  else {
    long long int temp = repow(n, k / 2, m);
    return temp * temp % m;
  }
}
long long int gcd(long long int num1, long long int num2) {
  return num2 != 0 ? gcd(num2, num1 % num2) : num1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int A, B, C, D, E, F, N, M, K, L, X, Y, Z, H, W, sum = 0, num = 0,
                                                             flag = 0;
  string S, T;
  cin >> N;
  map<pair<long long int, long long int>, int> mp1;
  map<pair<long long int, long long int>, int> mp2;
  for (long long int i = 0; i < N; i++) {
    cin >> A >> B;
    C = gcd(abs(A), abs(B));
    if (A == B && A == 0)
      flag++;
    else if (B == 0)
      mp1[pair<long long int, long long int>(1, 0)]++;
    else if (A == 0)
      mp2[pair<long long int, long long int>(1, 0)]++;
    else if ((double)A / B >= 0) {
      A /= C;
      B /= C;
      if (A < 0 && B < 0) {
        A = -A;
        B = -B;
      }
      mp1[pair<long long int, long long int>(A, B)]++;
    } else {
      A /= C;
      B /= C;
      if (A < 0) {
        A = -A;
      } else
        B = -B;
      mp2[pair<long long int, long long int>(B, A)]++;
    }
  }
  num = 1;
  set<pair<long long int, long long int> > st;
  for (auto v : mp1) st.insert(v.first);
  for (auto v : mp2) st.insert(v.first);
  for (auto v : st) {
    if (mp1.find(v) != mp1.end() && mp2.find(v) != mp2.end()) {
      num *= (repow(2, mp1[v], 1000000007) + repow(2, mp2[v], 1000000007) - 1) %
             1000000007;
    } else if (mp1.find(v) != mp1.end()) {
      num *= (mp1[v] + 1);
    } else {
      num *= (mp2[v] + 1);
    }
    num %= 1000000007;
    cout << num << endl;
  }
  cout << (num + 1000000007 + flag - 1) % 1000000007 << endl;
}
