#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-9;
const long long INF = 1e15 + 10;
const long long mod = 1e9 + 7;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
map<pair<long long, long long>, int> m;
set<pair<long long, long long> > s;
int N;
long long powx[200001];
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  cin >> N;
  int z_z = 0, z_non = 0, non_z = 0;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      z_z++;
    } else if (a == 0) {
      z_non++;
    } else if (b == 0) {
      non_z++;
    } else {
      int gg = gcd(a, b);
      a /= gg;
      b /= gg;
      if (a < 0) a = -a, b = -b;
      m[pair<long long, long long>(a, b)]++;
    }
  }
  powx[0] = 1;
  for (int i = 0; i < N; i++) powx[i + 1] = powx[i] * 2 % mod;
  long long ans = (powx[z_non] + powx[non_z] - 1) % mod;
  for (auto ite = m.begin(); ite != m.end(); ite++) {
    long long a = ite->first.first;
    long long b = ite->first.second;
    int cnt = ite->second;
    long long aa = -b;
    long long bb = a;
    if (aa < 0) aa = -aa, bb = -bb;
    if (s.find(pair<long long, long long>(aa, bb)) == s.end()) {
      s.insert(pair<long long, long long>(aa, bb));
      s.insert(pair<long long, long long>(a, b));
      int cnt2 = m[pair<long long, long long>(aa, bb)];
      long long tmp = (powx[cnt] + powx[cnt2] - 1) % mod;
      (ans *= tmp) %= mod;
    }
  }
  cout << (ans + mod + z_z - 1) % mod;
  return 0;
}
