#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
const long long maxn = (long long)3e5 + 5;
const long long mod = 1000000007;
const long long inf = 0x3f3f3f3f;
long long T = 1;
long long cntb, cnta, cntab;
long long fac[maxn];
long long _gcd(long long a, long long b) { return b == 0 ? a : _gcd(b, a % b); }
void solve() {
  fac[0] = 1;
  for (long long i = 1; i <= 2e5 + 5; ++i) fac[i] = fac[i - 1] * 2 % mod;
  map<pair<long long, long long>, long long> mp;
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (a * b == 0) {
      if (a == 0 && b == 0)
        ++cntab;
      else if (a == 0)
        ++cnta;
      else if (b == 0)
        ++cntb;
      continue;
    }
    if (a * b > 0) {
      a = abs(a), b = abs(b);
      long long gcd = _gcd(a, b);
      ++mp[pair<long long, long long>(a / gcd, b / gcd)];
    } else {
      a = abs(a), b = abs(b);
      long long gcd = _gcd(a, b);
      ++mp[pair<long long, long long>(-a / gcd, b / gcd)];
    }
  }
  long long ans = ((fac[cnta] + fac[cntb] - 1) % mod + mod) % mod;
  for (auto &to : mp) {
    if (to.second == 0) continue;
    long long a = to.first.first, b = to.first.second;
    long long num = to.second;
    pair<long long, long long> j = a > 0 ? pair<long long, long long>(-b, a)
                                         : pair<long long, long long>(b, -a);
    ans = (ans * (fac[num] + fac[mp[j]] - 1) % mod + mod) % mod;
    mp[j] = 0;
  }
  cout << ((ans - 1 + (cntab == 0 ? 0 : 1)) % mod + mod) % mod;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  while (T--) solve();
  return 0;
}
