#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9 + 7;
const int N = 200200;
int P[N];
void add_self(int& x, int y) {
  if ((x += y) >= Mod) x -= Mod;
}
int add(int x, int y) { return add_self(x, y), x; }
void sub_self(int& x, int y) {
  if ((x -= y) < 0) x += Mod;
}
int sub(int x, int y) { return sub_self(x, y), x; }
int mul(int x, int y) { return (long long)x * y % Mod; }
long long GCD(long long x, long long y) { return y ? GCD(y, x % y) : x; }
pair<long long, long long> Bad(pair<long long, long long> p) {
  p = make_pair(p.second, -p.first);
  if (p.first < 0 || (p.first == 0 && p.second < 0))
    p.first = -p.first, p.second = -p.second;
  return p;
}
int main() {
  P[0] = 1;
  for (int i = 1; i < N; ++i) P[i] = mul(2, P[i - 1]);
  int n;
  cin >> n;
  vector<long long> A(n);
  vector<long long> B(n);
  map<pair<long long, long long>, int> Cnt;
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld", &A[i], &B[i]);
    if (!A[i] && !B[i]) continue;
    long long G = GCD(A[i], B[i]);
    A[i] /= G;
    B[i] /= G;
    if (A[i] < 0 || (A[i] == 0 && B[i] < 0)) A[i] = -A[i], B[i] = -B[i];
    Cnt[make_pair(A[i], B[i])]++;
  }
  set<pair<long long, long long>> Have;
  vector<pair<int, int>> Friends;
  for (auto x : Cnt) {
    if (Have.count(x.first)) continue;
    pair<long long, long long> X = x.first;
    pair<long long, long long> Y = Bad(X);
    Have.insert(X);
    Have.insert(Y);
    Friends.emplace_back(Cnt[X], Cnt.count(Y) ? Cnt[Y] : 0);
  }
  int Ans = 1;
  for (pair<long long, long long> p : Friends) {
    int Res = sub(add(P[p.first], P[p.second]), 1);
    Ans = mul(Ans, Res);
  }
  sub_self(Ans, 1);
  cout << Ans << endl;
}
