#include <bits/stdc++.h>
using namespace std;
int N;
map<pair<long long, long long>, int> slope;
set<pair<long long, long long> > vis;
int cntzer1, cntzer2;
int memo[5005][5005];
long long GCD(long long A, long long B) { return B == 0 ? A : GCD(B, A % B); }
long long POW(long long X, long long Y) {
  long long res = 1;
  while (Y) {
    if (Y & 1) res = res * X % 1000000007;
    X = X * X % 1000000007;
    Y >>= 1;
  }
  return res;
}
void frac(long long A, long long B) {
  long long gcd = GCD(((A) < 0 ? -(A) : (A)), ((B) < 0 ? -(B) : (B)));
  slope[make_pair(A / gcd, B / gcd)]++;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  long long tam = 0;
  long long A, B;
  for (int i = 1; i <= N; i++) {
    cin >> A >> B;
    if ((A == 0) && (B == 0))
      tam++;
    else if (A == 0) {
      cntzer1++;
    } else if (B == 0) {
      cntzer2++;
    } else
      frac(A, B);
  }
  long long ans = 1;
  while (!slope.empty()) {
    long long x = slope.begin()->first.first, y = slope.begin()->first.second;
    long long val1 = 0, val2 = 0;
    val1 += slope.begin()->second;
    slope.erase(slope.begin());
    if (slope.count(make_pair(y, -x))) {
      val2 += slope[make_pair(y, -x)];
      slope.erase(make_pair(y, -x));
    }
    if (slope.count(make_pair(-y, x))) {
      val2 += slope[make_pair(-y, x)];
      slope.erase(make_pair(-y, x));
    }
    if (slope.count(make_pair(-x, -y))) {
      val1 += slope[make_pair(-x, -y)];
      slope.erase(make_pair(-x, -y));
    }
    ans = ans * (POW(2, val1) + POW(2, val2) - 1) % 1000000007;
  }
  ans = ans * (POW(2, cntzer1) + POW(2, cntzer2) - 1) % 1000000007;
  cout << ans - 1 + tam << "\n";
}
