#include <bits/stdc++.h>
using namespace std;
long long getgcd(long long a, long long b) {
  if (a == 0 && b == 0) {
    return 0LL;
  }
  if (b == 0) {
    return a;
  }
  return getgcd(b, a % b);
}
long long bigmod(long long a, long long m, long long mod) {
  long long ret = 1;
  while (m) {
    if ((m % 2) == 1) {
      ret = (ret * a) % mod;
    }
    a = (a * a) % mod;
    m /= 2;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, zero = 0;
  cin >> n;
  long long mod = 1000000007LL;
  map<pair<long long, long long>, long long> mp;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    long long gcd = getgcd(a, b);
    if (gcd == 0)
      zero++;
    else {
      a /= gcd, b /= gcd;
      if (a < 0) a = -a, b = -b;
      mp[{a, b}]++;
    }
  }
  long long ans = 1;
  for (auto x : mp) {
    if (x.second == 0) {
      continue;
    }
    long long tmp = bigmod(2LL, x.second, mod);
    long long a = x.first.first, b = x.first.second;
    b = -b;
    if (b < 0) {
      b = -b;
      a = -a;
    }
    if (mp.count({b, a})) {
      tmp = (tmp +
             bigmod(2LL,
                    mp[{
                        b,
                        a,
                    }],
                    mod) +
             mod - 1) %
            mod;
      mp[{b, a}] = 0;
    }
    ans = (ans * tmp) % mod;
  }
  ans = (ans + mod - 1) % mod;
  cout << ans << endl;
  return 0;
}
