#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1LL << 61;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
long long mpow(long long x, long long n) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = ans * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return ans;
}
vector<long long> tfact(1e7 + 1);
void fact(long long n) {
  for (long long i = 0; i <= n; i++) {
    if (i == 0) {
      tfact[i] = 1;
    } else {
      tfact[i] = tfact[i - 1] * i % mod;
    }
  }
}
long long comb(long long n, long long k) {
  return tfact.at(n) * mpow(tfact.at(k), mod - 2) % mod *
         mpow(tfact.at(n - k), mod - 2) % mod;
}
int main() {
  long long n;
  cin >> n;
  fact(n);
  map<pair<long long, long long>, long long> cnt1, cnt2;
  long long zn = 0, za = 0, zb = 0;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zn++;
    } else if (a == 0) {
      za++;
    } else if (b == 0) {
      zb++;
    } else {
      long long g = gcd(a, b);
      a /= g;
      b /= g;
      if (a * b > 0) {
        a = abs(a);
        b = abs(b);
      } else {
        a = abs(a);
        b = -abs(b);
      }
      cnt1[{a, b}]++;
      if (b < 0) {
        b *= -1;
        a *= -1;
      }
      cnt2[{b, -a}]++;
    }
  }
  long long ans = 1;
  set<pair<long long, long long> > al;
  for (auto p : cnt1) {
    if (al.count(p.first)) continue;
    long long a = p.first.first;
    long long b = p.first.second;
    al.insert({a, b});
    ans = ans * (mpow(2, p.second) + mpow(2, cnt2[p.first]) - 1 + mod) % mod;
    if (b < 0) {
      b *= -1;
      a *= -1;
    }
    al.insert({b, -a});
  }
  ans = ans * mpow(2, mod - 2) % mod;
  ans = ans * (mpow(2, za) + mpow(2, zb) + mod) % mod;
  ans = (ans + zn - 1 + mod) % mod;
  cout << ans << endl;
}
