#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007, bk2[200010];
map<pair<long long, long long>, int> mp;
long long gcd(long long a, long long b) {
  if (a % b) return gcd(b, a % b);
  return b;
}
int main(void) {
  int N;
  cin >> N;
  long long ans = 0;
  bk2[0] = 1;
  for (int i = 1; i <= N; ++i) bk2[i] = (bk2[i - 1] * 2) % mod;
  for (int i = 0; i < N; ++i) {
    long long A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
      ++ans;
    } else if (A == 0) {
      ++mp[make_pair(0, -1)];
    } else if (B == 0) {
      ++mp[make_pair(1, 0)];
    } else {
      long long h = gcd(abs(A), abs(B));
      if (A > 0 ^ B > 0) {
        ++mp[make_pair(abs(A) / h, -abs(B) / h)];
      } else {
        ++mp[make_pair(abs(A) / h, abs(B) / h)];
      }
    }
  }
  ans = (bk2[ans] + mod - 1) % mod;
  long long mult = 1;
  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    pair<long long, long long> f = itr->first;
    swap(f.first, f.second);
    if (f.first < 0)
      f.first *= -1;
    else
      f.second *= -1;
    (mult *= (bk2[itr->second] + bk2[mp[f]] + mod - 1) % mod) %= mod;
    itr->second = 0;
    mp[f] = 0;
  }
  (ans += mult + mod - 1) %= mod;
  cout << ans << endl;
  return 0;
}
