#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 3;
const int M = 1000000007;
long long modexp(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0)
    return modexp((a * a) % M, b / 2);
  else
    return (a * modexp((a * a) % M, b / 2)) % M;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  a %= b;
  return gcd(b, a);
}
void solve() {
  int n;
  scanf("%d", &n);
  map<pair<long long, long long>, long long> mp;
  long long cnt0 = 0, cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < n; i++) {
    long long x, y;
    scanf("%lld", &x);
    scanf("%lld", &y);
    if (x == 0 && y == 0) {
      ++cnt0;
    } else if (x == 0) {
      ++cnt1;
    } else if (y == 0) {
      ++cnt2;
    } else {
      long long x1 = abs(x);
      long long y1 = abs(y);
      long long g = gcd(x1, y1);
      x1 = x1 / g;
      y1 = y1 / g;
      x = x / g;
      y = y / g;
      if ((x1 / x) != (y1 / y)) {
        x1 = -1ll * x1;
      }
      mp[{x1, y1}]++;
    }
  }
  long long ans = 1;
  for (auto it = mp.begin(); it != mp.end(); ++it) {
    pair<long long, long long> p1 = it->first;
    long long cnt = it->second;
    if (cnt == 0) continue;
    pair<long long, long long> p2;
    if (p1.first > 0 && p2.first > 0) {
      p2.first = -1ll * p1.second;
      p2.second = p1.first;
    } else {
      p2.first = p1.second;
      p2.second = -1ll * p1.first;
    }
    auto it1 = mp.find(p2);
    long long cnt1 = 0;
    if (it1 != mp.end()) {
      cnt1 = (it1->second);
      mp[p2] = 0;
    }
    long long way = modexp(2ll, cnt);
    if (cnt1 != 0) {
      way += modexp(2ll, cnt1);
      way %= M;
      way = (way - 1 + M) % M;
    }
    ans = (ans * (way)) % M;
  }
  if (cnt0 != 0) {
    ans = (ans + 1) % M;
  }
  printf("%lld\n", ans);
}
int main() {
  solve();
  return 0;
}
