#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long poww(long long x, long long e) {
  if (e == 0) {
    return 1;
  }
  long long ans = poww(x, e / 2);
  ans *= ans;
  ans %= 1000000007;
  if (e % 2) {
    ans *= x;
    ans %= 1000000007;
  }
  return ans;
}
pair<long long, long long> norm(pair<long long, long long> &x) {
  if (x.first < 0) {
    x.first *= -1;
    x.second *= -1;
  } else if (x.first == 0) {
    if (x.second < 0) x.second *= -1;
  }
  long long g = gcd(abs(x.first), abs(x.second));
  x.first /= g;
  x.second /= g;
  return x;
}
pair<long long, long long> getRival(pair<long long, long long> x) {
  pair<long long, long long> y = x;
  swap(y.first, y.second);
  y.first *= -1;
  norm(y);
  return y;
}
long long soma(long long a, long long b) { return (a + b) % 1000000007; }
long long sub(long long a, long long b) {
  a %= 1000000007;
  b %= 1000000007;
  a -= b;
  if (a < 0) a += 1000000007;
  return a % 1000000007;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<long long, long long> > sard(n);
  for (int i = 0; i < n; i++) {
    scanf("%lld %lld", &sard[i].first, &sard[i].second);
    norm(sard[i]);
  }
  map<pair<long long, long long>, int> qnt;
  for (pair<long long, long long> x : sard) {
    qnt[x]++;
  }
  vector<pair<long long, long long> > rivs;
  for (auto el : qnt) {
    pair<long long, long long> x = el.first;
    int f = el.second;
    if (f == 0) continue;
    pair<long long, long long> rival = getRival(x);
    pair<long long, long long> toput;
    toput.first = f;
    toput.second = qnt[rival];
    qnt[rival] = 0;
    rivs.push_back(toput);
  }
  long long ans = 1;
  for (pair<long long, long long> x : rivs) {
    ans *= sub(soma(poww(2, x.first), poww(2, x.second)), 1);
    ans %= 1000000007;
  }
  printf("%lld\n", sub(ans, 1));
  return 0;
}
