#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
ll gcd(ll x, ll y) {
  if (x < y) swap(x, y);
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long mypow(long long k, long long n) {
  long long temp = 1;
  k = k % 1000000007;
  while (n) {
    if (n % 2) temp = temp * k % 1000000007;
    k = k * k % 1000000007;
    n = n / 2;
  }
  return temp % 1000000007;
}
int main() {
  int N;
  cin >> N;
  map<tuple<int, ll, ll>, int> cnt;
  ll zab = 0, za = 0, zb = 0;
  for (int i = 0; i < N; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      zab++;
    else if (a == 0)
      za++;
    else if (b == 0)
      zb++;
    else {
      ll co = gcd(abs(a), abs(b));
      tuple<int, ll, ll> temp;
      if (a * b >= (ll)0)
        get<0>(temp) = 1;
      else
        get<0>(temp) = -1;
      get<1>(temp) = abs(a) / co, get<2>(temp) = abs(b) / co;
      cnt[temp]++;
    }
  }
  ll a1 = 1;
  map<tuple<int, ll, ll>, bool> his;
  for (auto x : cnt) {
    his[x.first] = true;
    tuple<int, ll, ll> pr;
    get<0>(pr) = -1 * get<0>(x.first), get<1>(pr) = get<2>(x.first),
    get<2>(pr) = get<1>(x.first);
    if (his[pr]) continue;
    his[pr] = true;
    ll temp = (mypow(2, x.second) + mypow(2, cnt[pr]) - 1) % 1000000007;
    a1 *= temp;
    a1 %= 1000000007;
  }
  a1 *= (mypow(2, za) + mypow(2, zb) - 1) % 1000000007;
  a1 %= 1000000007;
  a1 += zab;
  a1 %= 1000000007;
  cout << a1 - 1 << endl;
}
