#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
const int mod = 1000000007;
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long p[maxn];
int main() {
  int n;
  cin >> n;
  p[0] = 1;
  for (int i = 1; i <= n; i++) p[i] = p[i - 1] * 2 % mod;
  map<pair<long long, long long>, int> mp;
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    if (x == 0) {
      if (y != 0) {
        y = 1;
      }
    } else {
      if (y == 0) {
        x = 1;
      } else {
        long long tt = gcd(abs(x), abs(y));
        x /= tt, y /= tt;
        if (x < 0) {
          x = -x;
          y = -y;
        }
      }
    }
    mp[make_pair(x, y)]++;
  }
  long long ret = 1;
  set<pair<long long, long long>> vis;
  for (auto pr : mp) {
    if (pr.first == make_pair(0LL, 0LL)) {
      continue;
    }
    if (vis.find(pr.first) != vis.end()) continue;
    auto tt = pr.first;
    vis.insert(pr.first);
    auto tt2 = make_pair(tt.second, -tt.first);
    if (tt2.first < 0) {
      tt2.first = -tt2.first;
      tt2.second = -tt2.second;
    }
    if (mp.find(tt2) == mp.end()) {
      ret = ret * p[pr.second] % mod;
    } else {
      ret = ret * (p[pr.second] + p[mp[tt2]] + mod - 1) % mod;
      vis.insert(tt2);
    }
  }
  ret = (ret + mod - 1) % mod;
  if (mp[make_pair(0LL, 0LL)]) {
    ret = (ret + 1) % mod;
  }
  cout << ret << endl;
  return 0;
}
