#include <bits/stdc++.h>
using namespace std;
map<pair<long long, long long>, long long> mp;
map<pair<long long, long long>, bool> used;
const long long mod = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
void normalization(long long &A, long long &B) {
  long long c = abs(A);
  long long d = abs(B);
  if (c == 0 && d == 0) {
    A = 0;
    B = 0;
    return;
  } else if (c == 0 || d == 0) {
    if (c == 0) {
      B = 1;
    } else {
      A = 1;
    }
    return;
  }
  long long g = gcd(c, d);
  c /= g;
  d /= g;
  if (A * B > 0) {
    A = c;
    B = d;
  } else {
    A = c;
    B = -d;
  }
  return;
}
long long p2(long long a) {
  if (a == 0) {
    return 1LL;
  } else if (a == 1) {
    return a;
  } else {
    if (a % 2 == 0) {
      return (p2(a / 2) * p2(a / 2)) % mod;
    } else {
      return (((p2((a - 1) / 2)) * (p2((a - 1) / 2)) % mod) * a) % mod;
    }
  }
}
signed main(void) {
  long long N;
  cin >> N;
  for (long long i = 0; i < N; i++) {
    long long A, B;
    cin >> A >> B;
    normalization(A, B);
    mp[{A, B}]++;
  }
  long long ans = 1LL;
  for (auto u : mp) {
    auto p = u.first;
    if (used[p]) {
      continue;
    }
    long long a = p.first;
    long long b = p.second;
    if (a == 0 && b == 0) {
      ans *= u.second + 1;
      ans %= mod;
      used[{0, 0}] = true;
    } else {
      if (a == 0 || b == 0) {
        long long x = mp[{1, 0}];
        long long y = mp[{0, 1}];
        ans *= (1 + (p2(x) - 1) + (p2(y) - 1) + mod) % mod;
        ans %= mod;
        used[{1, 0}] = used[{0, 1}] = true;
      } else {
        if (a * b > 0) {
          long long x = mp[{a, b}];
          long long y = mp[{b, -a}];
          ans *= (1 + (p2(x) - 1) + (p2(y) - 1) + mod) % mod;
          ans %= mod;
          used[{a, b}] = used[{b, -a}] = true;
        } else {
          long long x = mp[{a, b}];
          long long y = mp[{-b, a}];
          ans *= (1 + (p2(x) - 1) + (p2(y) - 1) + mod) % mod;
          ans %= mod;
          used[{a, b}] = used[{-b, a}] = true;
        }
      }
    }
  }
  ans = (ans - 1 + mod) % mod;
  cout << ans << endl;
  return 0;
}
