#include <bits/stdc++.h>
using namespace std;
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
const long long mod = 1000000000 + 7;
long long e_gcd(long long a, long long b) {
  return b != 0 ? e_gcd(b, a % b) : a;
}
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  map<pair<long long, long long>, pair<long long, long long> > d;
  for (decltype(n) i = 0; i < (n); i++) {
    bool f_or_s = false;
    long long a, b;
    cin >> a >> b;
    if ((a > 0 and b > 0) or (a < 0 and b < 0)) {
      f_or_s = false;
      a = abs(a);
      b = abs(b);
      int gcd = e_gcd(a, b);
      a /= gcd;
      b /= gcd;
    } else if ((a > 0 and b < 0) or (a < 0 and b > 0)) {
      f_or_s = true;
      swap(a, b);
      a = abs(a);
      b = abs(b);
      int gcd = e_gcd(a, b);
      a /= gcd;
      b /= gcd;
    } else if (a == 0 and b == 0) {
      f_or_s = false;
    } else {
      f_or_s = a > 0;
      a = 1;
      b = 0;
    }
    pair<long long, long long> p = pair<long long, long long>(a, b);
    if (d.count(p) == 0) d[p] = pair<long long, long long>(0, 0);
    if (f_or_s)
      d[p].first++;
    else
      d[p].second++;
  }
  long long res = 1;
  long long z = 0;
  for (pair<pair<long long, long long>, pair<long long, long long> > i : d) {
    if (i.first.first == 0 and i.first.second == 0) {
      z++;
      continue;
    }
    res *= modpow(2, i.second.first) + modpow(2, i.second.second) - 1;
    res %= mod;
  }
  cout << (res + z - 1) % mod << endl;
  return 0;
}
