#include <bits/stdc++.h>
using namespace std;
long long a, b, k, sol, zero1, zero2;
int n, m1, m2, n2;
double d;
set<double> S;
map<double, int> M;
long long arr[200005];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 0) {
      d = 0;
    } else if (b == 0) {
      d = LLONG_MAX;
    } else {
      d = (double)a / double(b);
    }
    S.insert(d);
    M[d]++;
  }
  arr[0] = 1;
  for (int i = 1; i <= n; i++) {
    arr[i] = ((arr[i - 1] * 2) % 1000000007);
  }
  sol = 1;
  for (auto e : S) {
    if (e < 0 && M[-1 / e] > 0) {
      m1 = M[e];
      m2 = M[-1 / e];
      sol *= (arr[m1] + arr[m2] - 1);
    } else if (e == 0) {
      m1 = M[0];
      m2 = M[LLONG_MAX];
      sol *= (arr[m1] + arr[m2] - 1);
    } else if (e != LLONG_MAX && M[-1 / e] == 0) {
      sol *= 2;
    }
    sol %= 1000000007;
  }
  cout << sol - 1;
}
