#include <bits/stdc++.h>
using namespace std;
long long n, a, b, q = 0, m = 1;
long long w[200001];
const long long M = 1e9 + 7;
map<pair<long long, long long>, pair<long long, long long> > Mp;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  cin >> n;
  w[0] = 1;
  for (int i = 1; i <= n; i++) w[i] = w[i - 1] * 2 % M;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0)
      q++;
    else {
      long long g = gcd(abs(a), abs(b));
      a /= g;
      b /= g;
      if (b == 0)
        a = 1;
      else if (b < 0) {
        a = -a;
        b = -b;
      }
      auto itr1 = Mp.find({a, b});
      auto itr2 = Mp.find({-b, a});
      auto itr3 = Mp.find({b, -a});
      if (itr1 != Mp.end())
        itr1->second.first++;
      else if (a > 0 && itr2 != Mp.end())
        itr2->second.second++;
      else if (itr3 != Mp.end())
        itr3->second.second++;
      else
        Mp[{a, b}] = {1, 0};
    }
  }
  for (auto it : Mp) {
    long long x = it.second.first, y = it.second.second;
    m = m * (w[x] + w[y] - 1) % M;
  }
  m = (m + q - 1) % M;
  cout << m << endl;
}
