#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, cnt = mod - 1;
  cin >> n;
  vector<long long> pot(n + 1);
  pot[0] = 1;
  for (long long i = 1; i < (n + 1); ++i) pot[i] = (2 * pot[i - 1]) % mod;
  map<pair<long long, long long>, pair<long long, long long> > m;
  while (n--) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 and b == 0) {
      cnt++;
      continue;
    }
    long long c = gcd(abs(a), abs(b));
    a /= c;
    b /= c;
    if (a < 0) {
      a = -a;
      b = -b;
    }
    if (b >= 0)
      m[{a, b}].first++;
    else
      m[{-b, a}].second++;
  }
  long long ans = 1;
  for (auto it : m) {
    pair<long long, long long> p = it.second;
    ans = (ans * ((pot[p.first] + pot[p.second] + mod - 1) % mod)) % mod;
  }
  cout << (ans + cnt) % mod << "\n";
}
