#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1001001001001001001;
const ll mod = 1000000007;
const int MAX = 1000100;
ll modpow(ll a, ll p) {
  ll ret = 1;
  while (p) {
    if (p & 1) ret = ret * a % mod;
    a = a * a % mod;
    p >>= 1;
  }
  return ret;
}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
int main() {
  int n;
  cin >> n;
  ll ans = 1;
  ll cnt = 0;
  map<pair<ll, ll>, pair<ll, ll>> mp;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      cnt++;
    } else if (a == 0) {
      mp[{0, 1}].first++;
    } else if (b == 0) {
      mp[{0, 1}].second++;
    } else {
      ll g = gcd(a, b);
      a /= g;
      b /= g;
      if (b < 0) {
        a = -a;
        b = -b;
      }
      if (a > 0) {
        mp[{a, b}].first++;
      } else {
        mp[{b, -a}].second++;
      }
    }
  }
  for (auto p : mp) {
    ll a = p.second.first, b = p.second.second;
    ans *= (modpow(2, a) + modpow(2, b) - 1) % mod;
    ans %= mod;
  }
  cout << (ans + cnt - 1) % mod << endl;
}
