#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  a = abs(a);
  b = abs(b);
  if (b < a) swap(a, b);
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long modpow(long long n, long long p) {
  long long ret = 1;
  while (p) {
    if (p & 1) {
      ret *= n;
      ret %= 1000000007;
    }
    p >>= 1;
    n = n * n;
    n %= 1000000007;
  }
  return ret;
}
pair<long long, long long> get_pair(long long a, long long b) {
  if (a == 0 and b == 0) return make_pair(0, 0);
  long long g = gcd(a, b);
  a /= g;
  b /= g;
  if (a < 0) {
    a *= -1;
    b *= -1;
  }
  return make_pair(a, b);
}
pair<long long, long long> get_anti(pair<long long, long long> p) {
  long long b = -p.first;
  long long a = p.second;
  if (a < 0) {
    a *= -1;
    b *= -1;
  }
  return make_pair(a, b);
}
void debug() {
  for (long long i = 0; i < (long long)(30); i++)
    cout << i << ":" << modpow(2, 30 + i) << endl;
}
int main() {
  long long N;
  cin >> N;
  long long A[N], B[N];
  for (long long n = 0; n < (long long)(N); n++) {
    cin >> A[n] >> B[n];
  }
  map<pair<long long, long long>, long long> fish_set;
  for (long long n = 0; n < (long long)(N); n++) {
    auto p = get_pair(A[n], B[n]);
    if (fish_set.count(p)) {
      fish_set[p] += 1;
    } else {
      fish_set[p] = 1;
    }
  }
  set<pair<long long, long long>> checked;
  long long ret = 1;
  long long zerozero = 0;
  for (auto fish : fish_set) {
    if (checked.count(fish.first)) continue;
    auto anti = get_anti(fish.first);
    checked.insert(anti);
    if (fish.first.first == 0 && fish.first.second == 0) {
      zerozero = 1;
      continue;
    }
    long long subret = modpow(2, fish.second);
    if (fish_set.count(anti)) {
      subret += modpow(2, fish_set[anti]) - 1;
      subret %= 1000000007;
    }
    ret *= subret;
    ret %= 1000000007;
  }
  ret = ret - 1 + zerozero;
  cout << ret << endl;
  return 0;
}
