#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
ll mod = 1e9 + 7;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int main() {
  vector<ll> powe(1e6, 0);
  powe[0] = 1;
  for (int i = 1; i < 1e6; i++) {
    powe[i] = (powe[i - 1] * 2) % mod;
  }
  int n;
  cin >> n;
  vector<pair<ll, ll> > a(n);
  map<pair<ll, ll>, int> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    ll p = gcd(a[i].first, a[i].second);
    a[i].first /= p;
    a[i].second /= p;
    if (a[i].first > 0 && a[i].second < 0) {
      a[i].first = -a[i].first;
      a[i].second = -a[i].second;
    }
    if (a[i].second < 0 && a[i].first < 0) {
      a[i].second = -a[i].second;
      a[i].first = -a[i].first;
    }
    m[a[i]]++;
  }
  ll ans = 1;
  for (auto it : m) {
    if (it.first.first == 0 && it.first.second == 0) {
      ans++;
      continue;
    }
    if (it.first.first < 0) {
      if (m.find({it.first.second, -it.first.first}) == m.end())
        ans = (ans * (it.second + 1)) % mod;
      continue;
    }
    ll p = it.second;
    ll q = 0;
    if (m.find({-it.first.second, it.first.first}) != m.end())
      ;
    { q = m[{-it.first.second, it.first.first}]; }
    ll res = (powe[p] - 1 + powe[q] - 1 + mod) % mod;
    ans = (ans * (res + 1)) % mod;
  }
  cout << (ans - 1 + mod) % mod << endl;
}
