#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) gcd(b, a);
  long long r = 1;
  while (r != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long modpow(long long a, long long n, long long mod = 1000000007) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long sign(long long n) {
  if (n >= 0) {
    return 1;
  } else {
    return -1;
  }
}
int main() {
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> cnt;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      cnt[make_pair(0, 0)]++;
    } else if (a == 0 && b != 0) {
      cnt[make_pair(0, 1)]++;
    } else if (a != 0 && b == 0) {
      cnt[make_pair(1, 0)]++;
    } else {
      long long g = gcd(abs(a), abs(b));
      long long sig = sign(a * b);
      cnt[make_pair(sig * abs(a) / g, abs(b) / g)]++;
    }
  }
  long long ans = 1;
  for (auto e : cnt) {
    if (e.second == 0) {
      continue;
    }
    if (e.first == make_pair(0LL, 0LL)) {
      continue;
    }
    pair<int, int> ort;
    if (e.first == make_pair(0LL, 1LL)) {
      ort = make_pair(1, 0);
    } else if (e.first == make_pair(1LL, 0LL)) {
      ort = make_pair(0, 1);
    } else {
      ort = make_pair(-sign(e.first.first) * abs(e.first.second),
                      abs(e.first.first));
      ;
    }
    ans *= modpow(2, e.second) + modpow(2, cnt[ort]) - 1;
    ans %= 1000000007;
    cnt[ort] = 0;
    cnt[e.first] = 0;
  }
  cout << (cnt[make_pair(0, 0)] + ans - 1 + 1000000007) % 1000000007 << endl;
}
