#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
void chmin(T &a, T b) {
  if (a > b) a = b;
}
constexpr long long INF = 1000000000000000000;
constexpr long long mod = 1000000007;
constexpr double eps = 1e-12;
constexpr double pi = 3.14159265358979323846264338;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
bool prime(long long a) {
  if (a == 1) return false;
  for (long long i = 2; i * i <= a; i++) {
    if (a % i == 0) return false;
  }
  return true;
}
long long modpow(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2) return modpow(a, b - 1) * a % mod;
  long long memo = modpow(a, b / 2);
  return memo * memo % mod;
}
vector<long long> kaijo, invkaijo;
void init_fact(long long n) {
  kaijo.resize(n + 1);
  invkaijo.resize(n + 1);
  kaijo[0] = 1;
  for (long long i = 1; i <= n; i++) {
    kaijo[i] = kaijo[i - 1] * i;
    kaijo[i] %= mod;
  }
  for (long long i = 0; i < n + 1; i++) invkaijo[i] = modpow(kaijo[i], mod - 2);
}
long long comb(long long a, long long b) {
  if (a < b) return 0;
  if (a < 0 || b < 0) return 0;
  return kaijo[a] * modpow(kaijo[a - b], mod - 2) % mod *
         modpow(kaijo[b], mod - 2) % mod;
}
long long inv(long long x) {
  x = modpow(x, mod - 2);
  return x;
}
long long n;
pair<long long, long long> p[200010];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  map<pair<long long, long long>, long long> mp, mp2;
  long long f = 0;
  for (long long i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
    if (p[i].first == 0 && p[i].second == 0) {
      f++;
      continue;
    }
    long long g = gcd(abs(p[i].first), abs(p[i].second));
    mp[{p[i].first / g, p[i].second / g}]++;
    long long x = p[i].first / g, y = p[i].second / g;
    while (x < 0 || y < 0) {
      swap(x, y);
      x = -x;
    }
    mp2[{x, y}]++;
  }
  long long ans = 1;
  for (pair<pair<long long, long long>, long long> hoge : mp2) {
    long long x = hoge.first.first, y = hoge.first.second;
    vector<pair<long long, long long> > v;
    for (long long i = 0; i < 4; i++) {
      v.push_back({x, y});
      swap(x, y);
      x = -x;
    }
    long long res = 0;
    res++;
    for (long long i = 0; i < 4; i++) {
      res += modpow(2, mp[v[i]]) + mod - 1;
      res %= mod;
    }
    for (long long i = 0; i < 2; i++) {
      res += (modpow(2, mp[v[i]]) + mod - 1) % mod *
             (modpow(2, mp[v[i + 2]]) + mod - 1) % mod;
      res %= mod;
    }
    ans *= res;
    ans %= mod;
  }
  cout << ans - 1 + f << endl;
  return 0;
}
