#include <bits/stdc++.h>
using namespace std;
int n;
long long gcd(long long x, long long y) {
  if (y == 0LL) return x;
  return gcd(y, x % y);
}
long long labs(long long x) {
  if (x < 0LL) {
    return -x;
  }
  return x;
}
long long a[200005], b[200005];
vector<int> G[200005];
map<pair<long long, long long>, int> mp;
bool ng[200005];
long long as = 0;
long long bs = 0;
long long twop[200005];
int main(void) {
  scanf("%d", &n);
  twop[0] = 1;
  for (int i = 1; i <= n; i++) {
    twop[i] = twop[i - 1] * 2LL % 1000000007LL;
  }
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld", &a[i], &b[i]);
    if (a[i] == 0 && b[i] == 0) {
      ng[i] = true;
      continue;
    }
    if (a[i] == 0) {
      ng[i] = true;
      as++;
      continue;
    }
    if (b[i] == 0) {
      ng[i] = true;
      bs++;
      continue;
    }
    long long g = gcd(labs(a[i]), labs(b[i]));
    a[i] /= g;
    b[i] /= g;
    if (b[i] < 0) {
      b[i] = -b[i];
      a[i] = -a[i];
    }
    mp[pair<long long, long long>(a[i], b[i])]++;
  }
  long long ans = (twop[as] + twop[bs] - 1LL) % 1000000007LL;
  for (map<pair<long long, long long>, int>::iterator it = mp.begin();
       it != mp.end(); it++) {
    long long av = (*it).first.first;
    long long bv = (*it).first.second;
    long long val = twop[(*it).second];
    long long iav = -bv;
    long long ibv = av;
    if (ibv < 0) {
      ibv = -ibv;
      iav = -iav;
    }
    if (mp.find(pair<long long, long long>(iav, ibv)) != mp.end()) {
      if (av < 0) continue;
      val += twop[mp[pair<long long, long long>(iav, ibv)]] - 1LL;
      val %= 1000000007LL;
    }
    ans = ans * val % 1000000007LL;
  }
  ans--;
  if (ans < 0) {
    ans += 1000000007LL;
  }
  printf("%lld\n", ans);
  return 0;
}
