#include <bits/stdc++.h>
using namespace std;
long long int binpow(long long int a, long long int b,
                     long long int m = 1000000007) {
  a %= m;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int a[n], b[n];
  for (int x = 0; x < n; x++) cin >> a[x] >> b[x];
  map<pair<long long int, long long int>, long long int> ae;
  long long int d = 1;
  long long int f = 0;
  for (int x = 0; x < n; x++) {
    if (a[x] == 0 && b[x] == 0) continue;
    long long int r = gcd(abs(a[x]), abs(b[x]));
    a[x] /= r;
    b[x] /= r;
    if ((a[x] <= 0 && b[x] <= 0) || (a[x] >= 0 && b[x] >= 0)) {
      a[x] = abs(a[x]);
      b[x] = abs(b[x]);
    } else {
      a[x] = -abs(a[x]);
      b[x] = abs(b[x]);
    }
    ++ae[{a[x], b[x]}];
  }
  set<pair<long long int, long long int>> aw;
  for (auto it : ae) {
    long long int w;
    long long int we;
    aw.insert(it.first);
    pair<long long int, long long int> r;
    if (it.first.first > 0)
      r = {-it.first.second, it.first.first};
    else {
      r = {it.first.second, -it.first.first};
    }
    if (aw.count(r)) continue;
    w = ae[r];
    we = binpow(2, it.second + w);
    we -= ((((1000000007 + binpow(2, it.second) - 1) % 1000000007) *
            ((1000000007 + binpow(2, w) - 1) % 1000000007)) %
           1000000007) %
          1000000007;
    we = (2ll * 1000000007 + we) % 1000000007;
    d *= we;
    d %= 1000000007;
  }
  d %= 1000000007;
  d = (1000000007 + d - 1ll) % 1000000007;
  cout << d << "\n";
}
