#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 222222;
long long MOD = long long(1000000000 + 7);
long long fac2[MAX_N];
long long gcd(long long a, long long b) {
  if (a < b) {
    swap(a, b);
  }
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
void init() {
  fac2[0] = 1ll;
  for (int i = 1; i < MAX_N; i++) {
    fac2[i] = fac2[i - 1] * 2ll % MOD;
  }
}
int main(void) {
  init();
  long long N;
  cin >> N;
  unordered_map<long long, unordered_map<long long, int>> umap;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b != 0) {
      b = 1ll;
    }
    if (b == 0 && a != 0) {
      a = 1ll;
    }
    if (a == 0 || b == 0) {
      if (umap.count(a) == 0) {
        unordered_map<long long, int> u;
        u[b] = 1;
        umap[a] = u;
      } else {
        if (umap[a].count(b) == 0) {
          umap[a][b] = 1;
        } else {
          umap[a][b] += 1;
        }
      }
      continue;
    }
    long long d = gcd(abs(a), abs(b));
    a /= d;
    b /= d;
    if (a < 0) {
      a *= -1ll;
      b *= -1ll;
    }
    if (umap.count(a) == 0) {
      unordered_map<long long, int> u;
      u[b] = 1;
      umap[a] = u;
    } else {
      if (umap[a].count(b) == 0) {
        umap[a][b] = 1;
      } else {
        umap[a][b] += 1;
      }
    }
  }
  long long answer = 1;
  long long zero = 0;
  unordered_map<long long, set<long long>> searached;
  for (auto item : umap) {
    for (auto item2 : item.second) {
      long long a = item.first;
      long long b = item2.first;
      int n = item2.second;
      if (searached.count(a) != 0 && searached[a].count(b) != 0) continue;
      if (searached.count(a) == 0) {
        set<long long> s;
        s.insert(b);
        searached[a] = s;
      } else {
        searached[a].insert(b);
      }
      if (a == 0 && b == 0) {
        zero = n;
        continue;
      }
      long long a2 = 1;
      if (a == 0) {
        if (umap.count(b) != 0 && umap[b].count(a) != 0) {
          a2 = fac2[umap[b][a]];
        }
        if (searached.count(b) == 0) {
          set<long long> s;
          s.insert(a);
          searached[b] = s;
        } else {
          searached[b].insert(a);
        }
      } else if (b == 0) {
        if (umap.count(a) != 0 && umap[a].count(b) != 0) {
          a2 = fac2[umap[a][b]];
        }
        if (searached.count(a) == 0) {
          set<long long> s;
          s.insert(b);
          searached[a] = s;
        } else {
          searached[a].insert(b);
        }
      } else {
        long long na = abs(b);
        long long nb = a;
        if (b > 0) nb *= -1;
        if (umap.count(na) != 0 && umap[na].count(nb) != 0) {
          a2 = fac2[umap[na][nb]];
        }
        if (searached.count(na) == 0) {
          set<long long> s;
          s.insert(nb);
          searached[na] = s;
        } else {
          searached[na].insert(nb);
        }
      }
      answer *= (fac2[n] + a2 - 1ll);
      answer %= MOD;
    }
  }
  cout << (answer - 1ll + zero) % MOD << endl;
  return 0;
}
