#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long gcd(long long a, long long b) {
  while (b) {
    long long c = a % b;
    a = b;
    b = c;
  }
  return a;
}
int main() {
  ios::sync_with_stdio(false);
  int n, y = 0;
  long long a[200005] = {}, b[200005] = {}, z = 1, p[200005] = {1};
  map<pair<long long, long long>, int> m;
  set<pair<long long, long long>> s;
  cin >> n;
  for (int i = 1; i <= n; i++) p[i] = p[i - 1] * 2 % mod;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    long long g = gcd(abs(a[i]), abs(b[i]));
    if (g == 0) {
      y = 1;
      continue;
    }
    a[i] /= g;
    b[i] /= g;
    m[{a[i], b[i]}]++;
  }
  for (auto i : m)
    if (s.find(i.first) == s.end()) {
      long long c, d, x = i.first.first, y = i.first.second;
      s.insert({x, y});
      s.insert({-y, x});
      s.insert({-x, -y});
      s.insert({y, -x});
      c = m[{x, y}] + m[{-x, -y}];
      d = m[{-y, x}] + m[{y, -x}];
      z = z * (p[c] + p[d] - 1) % mod;
    }
  cout << (z + mod - 1 + y) % mod;
}
