#include <bits/stdc++.h>
using namespace std;
long long n, a, b, m = 1, q = 0;
long long w[200000];
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 {
      bool f = 0;
      if (b == 0) {
        a = 1;
        b = 0;
      } else if (b > 0) {
        long long g = gcd(abs(a), b);
        a /= g;
        b /= g;
      } else {
        long long g = gcd(abs(a), -b);
        a = -a / g;
        b = -b / g;
      }
      auto itr1 = Mp.find(make_pair(a, b));
      auto itr2 = Mp.find(make_pair(-b, a));
      auto itr3 = Mp.find(make_pair(b, -a));
      if (itr1 != Mp.end())
        itr1->second.first++;
      else if (itr2 != Mp.end())
        itr2->second.second++;
      else if (itr3 != Mp.end())
        itr3->second.second++;
      else
        Mp[make_pair(a, b)] = make_pair(1, 0);
    }
  }
  for (auto itr = Mp.begin(); itr != Mp.end(); itr++) {
    long long x = itr->second.first, y = itr->second.second;
    m = m * (w[x] + w[y] - 1) % M;
  }
  cout << m + q - 1 << endl;
}
