#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long MAX = 100005;
const long double PI = 3.14159265359;
const long double G = 9.807;
const long long INF = 1e18;
const long double EPS = 1e-6;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
bool isprime(long long a) {
  if (a == 2) return 1;
  if (!(a & 1)) return 0;
  for (long long i = 3; i * i <= a; i += 2)
    if (a % i == 0) return 0;
  return 1;
}
long long mpow(long long base, long long exponent, long long modulus) {
  if (modulus == 1) return 0;
  long long result = 1;
  base = base % modulus;
  while (exponent) {
    if (exponent % 2 == 1) result = (result * base) % modulus;
    exponent = exponent >> 1;
    base = (base * base) % modulus;
  }
  return result;
}
long long minv(long long a, long long mod) {
  long long _gcd = gcd(a, mod);
  assert(_gcd == 1);
  return mpow(a, mod - 2, mod);
}
long long n;
vector<pair<long long, long long> > a;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    long long x, y;
    cin >> x >> y;
    if (!x and !y) continue;
    a.push_back({x, y});
  }
  n = a.size();
  if (!n) {
    cout << 0;
    return 0;
  }
  map<pair<pair<long long, long long>, pair<long long, long long> >, long long>
      M;
  for (long long i = 0; i < n; ++i) {
    pair<long long, long long> foo, bar;
    if (a[i].second) {
      long long num = a[i].first;
      long long den = a[i].second;
      long long g = gcd(abs(num), abs(den));
      num /= g;
      den /= g;
      if (den < 0) {
        num = -num;
        den = -den;
      }
      foo = {num, den};
    } else {
      long long num = a[i].first;
      if (num < 0) {
        foo = {-5 * INF, 1};
      } else {
        foo = {5 * INF, 1};
      }
    }
    if (a[i].first) {
      long long num = a[i].second;
      long long den = a[i].first;
      long long g = gcd(abs(num), abs(den));
      num /= g;
      den /= g;
      num = -num;
      if (den < 0) {
        num = -num;
        den = -den;
      }
      bar = {num, den};
    } else {
      long long num = a[i].second;
      num = -num;
      if (num < 0) {
        bar = {-5 * INF, 1};
      } else {
        bar = {5 * INF, 1};
      }
    }
    M[{foo, bar}]++;
  }
  for (auto it : M) {
  }
  long long ans = 1;
  map<pair<pair<long long, long long>, pair<long long, long long> >, long long>
      f;
  for (auto it : M) {
    pair<long long, long long> foo = it.first.first;
    pair<long long, long long> bar = it.first.second;
    if (f.count({foo, bar}) or f.count({bar, foo})) continue;
    long long x = it.second;
    long long y = 0;
    if (M.count({bar, foo})) {
      y = M[{bar, foo}];
    }
    f[{foo, bar}]++;
    long long boom = (mpow(2LL, x, MOD) - 1 + MOD) % MOD;
    long long baam = (mpow(2LL, y, MOD) - 1 + MOD) % MOD;
    long long plis = (boom + baam + 1) % MOD;
    ans = ans * plis % MOD;
  }
  ans = (ans - 1 + MOD) % MOD;
  cout << ans;
  return 0;
}
