#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (a < b) {
    long long tmp = a;
    a = b;
    b = tmp;
  }
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
int main(void) {
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
  map<pair<long long, long long>, int> mp;
  vector<pair<long long, long long>> save_pair;
  for (int i = 0; i < N; i++) {
    bool minus_flag = false;
    long long a = A[i], b = B[i];
    if (a < 0) {
      minus_flag = !minus_flag;
      a = -1 * a;
    }
    if (b < 0) {
      minus_flag = !minus_flag;
      b = -1 * b;
    }
    long long waru = gcd(a, b);
    if (waru == 0) {
      if (mp[make_pair(0, 0)] == 0) {
        save_pair.push_back(make_pair(0, 0));
      }
      mp[make_pair(0, 0)]++;
    } else {
      a /= waru;
      b /= waru;
      if (minus_flag) a *= -1;
      if (mp[make_pair(a, b)] == 0) {
        save_pair.push_back(make_pair(a, b));
      }
      mp[make_pair(a, b)]++;
    }
  }
  long long ans = 1;
  long long zero_ans = 0;
  map<pair<long long, long long>, int> tansaku_flag;
  for (int i = 0; i < save_pair.size(); i++) {
    long long a = save_pair[i].first, b = save_pair[i].second;
    if (tansaku_flag[make_pair(a, b)] == 0) {
      if (a == 0 && b == 0) {
        zero_ans = mp[make_pair(0, 0)];
        tansaku_flag[make_pair(a, b)] = 1;
      } else {
        long long a2, b2;
        if (a < 0) {
          a2 = b;
          b2 = -a;
        } else {
          a2 = -b;
          b2 = a;
        }
        ans = (ans * (((modpow(2, mp[make_pair(a, b)], MOD) +
                        modpow(2, mp[make_pair(a2, b2)], MOD)) %
                       MOD) -
                      1)) %
              MOD;
        tansaku_flag[make_pair(a, b)] = 1;
        tansaku_flag[make_pair(a2, b2)] = 1;
      }
    }
  }
  cout << (ans + zero_ans - 1) % MOD << endl;
}
