#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > v;
map<pair<int, int>, long long> mp;
long long gcd(long long m, long long n) {
  if (m == 0) return n;
  if (n == 0) return m;
  if (n > m)
    return gcd(m, n % m);
  else
    return gcd(n, m % n);
}
int main() {
  int n;
  cin >> n;
  int a0 = 0, aa = 0, a1 = 0, yy;
  for (long long i = 0; i < n; i++) {
    long double x, y;
    cin >> x >> y;
    if (!x && !y) {
      aa++;
      continue;
    }
    if (y == 0) {
      a0++;
      continue;
    }
    if (x == 0) {
      a1++;
      continue;
    }
    if (x < 0) {
      x = -x;
      y = -y;
    }
    if (y > 0)
      yy = y;
    else
      yy = -y;
    pair<int, int> p = pair<int, int>(x / gcd(x, yy), y / gcd(x, yy));
    if (v.find(p) != v.end())
      mp[p]++;
    else {
      mp[p] = 1;
      v.insert(p);
    }
  }
  long long ans = 1;
  auto j = v.begin();
  for (long long i = 0; i < v.size(); i++) {
    pair<int, int> t = *j, p;
    if (t.second < 0) {
      p = pair<int, int>(-t.second, t.first);
    } else
      p = pair<int, int>(t.second, -t.first);
    if (v.find(p) != v.end()) {
      long long y1 = 1, y2 = 1;
      for (long long k = 0; k < mp[t]; k++) y1 = y1 * 2 % 1000000007;
      for (long long k = 0; k < mp[p]; k++) y2 = y2 * 2 % 1000000007;
      long long yy = (y1 + y2 - 1) % 1000000007;
      ans = ans * yy % 1000000007;
      mp[t] = 0;
      mp[p] = 0;
    }
    j++;
  }
  auto i = mp.begin();
  for (long long k = 0; k < mp.size(); k++) {
    long long xx = 1;
    for (long long k = 0; k < i->second; k++) xx = xx * 2 % 1000000007;
    ans = ans * xx % 1000000007;
    i++;
  }
  long long y1 = 1, y2 = 1;
  for (long long k = 0; k < a0; k++) y1 = y1 * 2 % 1000000007;
  for (long long k = 0; k < a1; k++) y2 = y2 * 2 % 1000000007;
  long long ye = (y1 + y2 - 1) % 1000000007;
  ans = ans * ye % 1000000007;
  ans += aa;
  ans %= 1000000007;
  if (ans == 0) ans += 1000000007;
  cout << ans - 1;
  return 0;
}
