#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long a[200005];
long long b[200005];
long long gcd(long long a, long long b) {
  if (a < 0) {
    a = -a;
  }
  if (b < 0) {
    b = -b;
  }
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
long long qkp(long long a, long long b) {
  long long res = 1, t = a;
  while (b) {
    if (b & 1) {
      res *= t;
      res %= mod;
    }
    b >>= 1;
    t *= t;
    t %= mod;
  }
  return res;
}
int main() {
  map<pair<long long, long long>, int> mp;
  int n;
  scanf("%d", &n);
  long long ans = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &a[i], &b[i]);
    if (a[i] < 0) {
      a[i] = -a[i];
      b[i] = -b[i];
    }
    if (a[i] == 0 && b[i] > 0) {
      b[i] = -b[i];
    }
    long long t = gcd(a[i], b[i]);
    if (t != 0) {
      a[i] /= t;
      b[i] /= t;
    }
    if (mp.count(make_pair(a[i], b[i]))) {
      mp[make_pair(a[i], b[i])]++;
    } else {
      mp[make_pair(a[i], b[i])] = 1;
    }
  }
  for (auto it = mp.begin(); it != mp.end(); it++) {
    long long x = (*it).first.first;
    long long y = (*it).first.second;
    long long num = (*it).second;
    long long as = qkp(2, num);
    mp[make_pair(x, y)] = 0;
    if (x > 0 && y > 0) {
      long long t = x;
      x = y;
      y = -t;
    } else {
      long long t = x;
      x = -y;
      y = t;
    }
    if (mp.count(make_pair(x, y))) {
      as += qkp(2, mp[make_pair(x, y)]) - 1;
      as %= mod;
      mp[make_pair(x, y)] = 0;
    }
    ans *= as;
    ans %= mod;
  }
  ans--;
  if (mp.count(make_pair(0, 0))) {
    ans += qkp(2, mp[make_pair(0, 0)]) - 1;
  }
  printf("%lld\n", ans);
  return 0;
}
