#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long mpow(long long x, long long n) {
  long long ans = 1;
  while (n) {
    if (n % 2) {
      ans = ans * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (a == 0 && b == 0)
    return 0;
  else if (a == 0)
    return b;
  else if (b == 0)
    return a;
  else {
    if (a < 0) a = -a;
    if (b < 0) b = -b;
    if (a < b) swap(a, b);
    while (true) {
      long long p = a % b;
      a = b;
      b = p;
      if (p == 0) break;
    }
    return a;
  }
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  vector<int> A, B;
  int N;
  cin >> N;
  long long none = 0;
  map<pair<long long, long long>, pair<long long, long long> > iwashi;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      none++;
    else {
      long long g = gcd(a, b);
      a = a / g;
      b = b / g;
      if (b < 0) {
        a = -a;
        b = -b;
      } else if (b == 0 && a < 0)
        a = -a;
      if (a <= 0) {
        long long tmp = a;
        a = b;
        b = -tmp;
        iwashi[pair<long long, long long>(a, b)].second++;
      } else {
        iwashi[pair<long long, long long>(a, b)].first++;
      }
    }
  }
  long long ans = 1;
  for (auto i : iwashi) {
    long long now = mpow(2, i.second.first) + mpow(2, i.second.second) - 1;
    ans = ans * now % mod;
  }
  ans--;
  ans += none;
  cout << ans % mod << endl;
}
