#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e18 + 10;
const double PI = 2.0 * acos(0);
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int dy[] = {-1, 1, 0, 0};
int dx[] = {0, 0, -1, 1};
ll gcd(ll a, ll b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
void solve(int ca) {
  int N;
  cin >> N;
  ll a, b, c;
  map<pair<int, int>, int> mp;
  int a0 = 0, b0 = 0;
  int ab0 = 0;
  for (int i = 0; i < N; ++i) {
    cin >> a >> b;
    if (a < 0 && b < 0) {
      a *= -1;
      b *= -1;
    }
    if (a == 0 && b == 0)
      ab0++;
    else if (a == 0)
      a0++;
    else if (b == 0)
      b0++;
    c = gcd(abs(a), abs(b));
    a /= c;
    b /= c;
    mp[make_pair(a, b)]++;
  }
  vector<pair<int, int>> vec;
  vec.push_back(make_pair(a0, b0));
  for (auto i : mp) {
    auto val = i.first;
    if ((val.first > 0) ^ (val.second > 0)) {
      if (mp.find(make_pair(val.second, -val.first)) != mp.end() ||
          mp.find(make_pair(-val.second, val.first)) != mp.end())
        continue;
      vec.push_back(make_pair(i.second, 0));
      continue;
    }
    int tui = 0;
    tui += mp[make_pair(-val.second, val.first)];
    tui += mp[make_pair(val.second, -val.first)];
    vec.push_back(make_pair(i.second, tui));
  }
  ll ans = 1ll;
  for (auto i : vec) {
    if (i.second != 0) {
      (ans *= (modpow(2, i.first, MOD) + modpow(2, i.second, MOD) + MOD - 1) %
              MOD) %= MOD;
    } else {
      (ans *= modpow(2, i.first, MOD)) %= MOD;
    }
  }
  ans += ab0 - 1;
  cout << ans << endl;
}
int main() {
  solve(0);
  return 0;
}
