#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 0LL;
long long MOD = 1e18 + 0LL;
double pi = acos(-1);
long long md = 1000000007;
long long gcd(long long a, long long b) {
  return b == 0 ? abs(a) : gcd(b, a % b);
}
long long pow(long long a, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 0) {
    long long b = pow(a, n / 2);
    return (b * b) % md;
  }
  return (pow(a, n - 1) * a) % md;
}
int main() {
  int cs = 1;
  while (cs--) {
    long long n;
    cin >> n;
    map<pair<long long, long long>, long long> mp;
    long long zeros = 0;
    for (long long i = 0; i < n; i++) {
      long long a, b;
      cin >> a >> b;
      if (b < 0) {
        a *= -1;
        b *= -1;
      }
      long long d = gcd(a, b);
      if (d == 0) {
        zeros++;
        continue;
      }
      a /= d;
      b /= d;
      mp[{a, b}]++;
    }
    long long ans = 1LL;
    map<pair<long long, long long>, long long>::iterator smth;
    for (smth = mp.begin(); smth != mp.end(); smth++) {
      pair<long long, long long> x = smth->first;
      long long amount = smth->second;
      long long tomult = pow(2, amount);
      long long a = x.first, b = x.second;
      mp[{a, b}] = 0;
      swap(a, b);
      b *= -1;
      if (mp.count({a, b}) > 0) {
        tomult += pow(2, mp[{a, b}]);
        tomult += md - 1;
        tomult %= md;
        mp[{a, b}] = 0;
      }
      ans *= tomult;
      ans %= md;
    }
    ans += md - 1 + zeros;
    ans %= md;
    cout << ans;
  }
}
