#include <bits/stdc++.h>
using namespace std;
map<pair<long long, long long>, long long> t;
long long N;
long long arr[200100][4];
long long po[200100];
long long gc(long long a, long long b) { return b ? gc(b, a % b) : a; }
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  long long i;
  for (i = 0; i <= N; i++) {
    if (!i)
      po[i] = 1;
    else
      po[i] = po[i - 1] * 2 % 1000000007;
  }
  long long ans = 1;
  for (i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) ans++;
    long long c = 0;
    while (!((a >= 0) && (b > 0))) {
      c++;
      long long r = a;
      a = -b;
      b = r;
    }
    long long x = gc(a, b);
    a /= x;
    b /= x;
    long long r = t[{a, b}];
    if (r) {
      arr[r][c]++;
    } else {
      t[{a, b}] = t.size();
      arr[t.size()][c]++;
    }
  }
  N = t.size();
  for (i = 1; i <= N; i++) {
    long long th = (po[arr[i][0] + arr[i][2]] + po[arr[i][1] + arr[i][3]] - 1) %
                   1000000007;
    ans = ans * th % 1000000007;
  }
  cout << (ans + 1000000006) % 1000000007;
}
