#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a > b) swap(a, b);
  if (b % a == 0) return a;
  return gcd(b % a, a);
}
long long mod = 1e9 + 7;
long long pow(int n) {
  long long base = 2;
  long long cur = 1;
  while (n > 0) {
    if (n % 2) cur = cur * base % mod;
    n = n / 2;
    base = base * 2 % mod;
  }
  return cur;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<pair<long long, long long> > sa(n);
  map<pair<long long, long long>, int> cnt;
  for (auto& p : sa) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      cnt[{0, 0}]++;
    } else if (a != 0 && b != 0) {
      if (a < 0) {
        a = -a;
        b = -b;
      }
      long long g = gcd(abs(a), abs(b));
      cnt[{a / g, b / g}]++;
    } else {
      if (a == 0)
        cnt[{0, 1}]++;
      else
        cnt[{1, 0}]++;
    }
  }
  long long ans00 = 1;
  if (cnt[{0, 0}] == 0)
    ans00 = 0;
  else
    ans00 = cnt[{0, 0}];
  cnt.erase({0, 0});
  long long ans = 1;
  while (!cnt.empty()) {
    pair<pair<long long, long long>, int> cur = *cnt.begin();
    cnt.erase(cnt.begin());
    pair<long long, long long> curp = cur.first;
    pair<long long, long long> rcurp = {curp.second, -curp.first};
    if (rcurp.first < 0) {
      rcurp = {-curp.second, curp.first};
    }
    if (cnt.find(rcurp) == cnt.end()) cnt[rcurp] = 0;
    auto rcurit = cnt.find(rcurp);
    ans = ans * (pow(cur.second) - 1 + pow(rcurit->second) - 1 + 1) % mod;
    cnt.erase(rcurit);
  }
  ans--;
  cout << (ans + ans00) % mod;
}
