#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fpow(ll b, ll p) {
  if (p == 0) return 1;
  ll m = fpow(b, p / 2);
  if (p % 2) return m * m % (ll)(1e9 + 7) * b % (ll)(1e9 + 7);
  return m * m % (ll)(1e9 + 7);
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  map<pii, pii> mp;
  for (ll i = 0; i <= n - 1; i++) {
    ll a, b, g;
    cin >> a >> b;
    g = gcd(a, b);
    a /= g;
    b /= g;
    if ((a > 0 && b > 0) || (a < 0 && b < 0))
      mp[{abs(a), abs(b)}].first++;
    else
      mp[{abs(a), abs(b)}].second++;
  }
  ll ans = 1;
  for (auto &i : mp) {
    pii a = i.second, b = mp[{i.first.second, i.first.first}];
    ans = (ans * (fpow(2, a.first) + fpow(2, b.second) - 1)) % (ll)(1e9 + 7);
    if (i.first.first != i.first.second)
      ans = (ans * (fpow(2, a.second) + fpow(2, b.first) - 1)) % (ll)(1e9 + 7);
    i.second = {0, 0};
    mp[{i.first.second, i.first.first}] = {0, 0};
  }
  cout << (ans + (ll)(1e9 + 7) - 1) % (ll)(1e9 + 7) << "\n";
  return 0;
}
