#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1000000007;
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  long long r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}
long long power(long long m, long long n) {
  if (n == 0) return 1;
  if (n == 1) return m;
  long long res = power(m, n / 2);
  res = res * res % MOD;
  if (n % 2 == 1) res *= m;
  return res % MOD;
}
int main() {
  int n;
  cin >> n;
  pair<long long, long long> P[n];
  long long zc = 0;
  long long a, b;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0)
      zc++;
    else if (a == 0) {
      b = -1;
    } else if (b == 0) {
      a = 1;
    } else {
      long long g = gcd(abs(a), abs(b));
      a /= g;
      b /= g;
      if (a < 0) {
        a = -a;
        b = -b;
      }
    }
    P[i] = make_pair(a, b);
  }
  map<pair<long long, long long>, long long> mp;
  for (int i = 0; i < n; i++) {
    if (mp.find(P[i]) == mp.end())
      mp[P[i]] = 1;
    else
      mp[P[i]] += 1;
  }
  vector<long long> cnt;
  set<pair<long long, long long>> visited;
  for (int i = 0; i < n; i++) {
    if (visited.find(P[i]) != visited.end()) continue;
    pair<long long, long long> q = make_pair(P[i].second, -P[i].first);
    if (q.first < 0) {
      q.first = -q.first;
      q.second = -q.second;
    }
    long long c1 = mp[P[i]];
    long long c2 = (mp.find(q) == mp.end()) ? 0 : mp[q];
    long long c = power(2, c1);
    if (c2 > 0) c += power(2, c2) - 1;
    c %= MOD;
    cnt.push_back(c);
    visited.insert(P[i]);
    visited.insert(q);
  }
  long long count = 1;
  for (auto c : cnt) {
    count *= c % MOD;
    count %= MOD;
  }
  if (zc > 0) count++;
  cout << count - 1 << endl;
  return 0;
}
