#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <iostream>
#include <queue>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

const ll M = 1e9+7;

ll n, zero, ans;
map<P, ll> mp1;
map<P, ll> mp2;

ll mpow(ll a, ll n) {
  if (n == 0) return 1;
  if (n % 2) return mpow(a, n-1) * a % M;
  return mpow(a * a % M, n/2);
}

int main()
{
  cin >> n;
  
  for (ll i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 and b == 0) zero++;
    else if (a == 0) mp1[P(0, 1)]++;
    else if (b == 0) mp2[P(0, 1)]++;
    else if (a * b > 0) {
      a = abs(a);
      b = abs(b);
      ll tmp = gcd(a, b);
      a /= tmp;
      b /= tmp;
      mp1[P(a, b)]++;
    } else {
      a = abs(a);
      b = abs(b);
      ll tmp = gcd(a, b);
      a /= tmp;
      b /= tmp;
      mp2[P(b, a)]++;
    }
  }
  
  ll cnt = 1;
  for (auto p: mp1) {
    ll x = p.second;
    ll y = mp2[p.first];
    if (y == 0) {
      cnt *= mpow(2, x);
      cnt %= M;
      continue;
    }
    cnt = (cnt * (mpow(2, x) + mpow(2, y) - 1 + M) % M) % M;
  }
  
  for (auto p: mp2) {
    ll x = p.second;
    ll y = mp1[p.first];
    if (y == 0) {
      cnt *= mpow(2, x);
      cnt %= M;
    }
  }
  
  cout << (cnt-1 + M) % M << endl;
  return 0;
}