#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1e9 + 7;
const int mxN = 2e5 + 5;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long power[mxN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(9);
  power[0] = 1;
  for (int i = 1; i < mxN; i++) {
    power[i] = power[i - 1] * 2 % Mod;
  }
  int n;
  cin >> n;
  int special = 0;
  map<pair<long long, long long>, pair<int, int>> mp;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0LL && b == 0LL) {
      special++;
      continue;
    } else if (a == 0LL) {
      b = 1;
    } else if (b == 0LL) {
      a = -1;
    } else {
      long long g = gcd(abs(a), abs(b));
      a = a / g, b = b / g;
      if (b < 0) a = -a, b = -b;
    }
    pair<long long, long long> ang = make_pair(a, b);
    pair<long long, long long> bad =
        a >= 0 ? make_pair(-b, a) : make_pair(b, -a);
    if (mp.find(bad) != mp.end()) {
      mp[bad].second++;
    } else {
      mp[ang].first++;
    }
  }
  long long ans = 1;
  for (auto& p : mp) {
    if (p.second.second == 0) {
      ans = ans * power[p.second.first] % Mod;
    } else {
      ans = ans * (power[p.second.first] + power[p.second.second] - 1) % Mod;
    }
  }
  cout << (ans - 1 + special) % Mod << '\n';
}
