#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  if (b == 0) return (a);
  return (gcd(b, a % b));
}
int main(void) {
  int n;
  cin >> n;
  multiset<pair<long long, long long>> iwashi;
  long long a, b;
  long long tmp_ans = 0;
  long long a_zero = 0;
  long long b_zero = 0;
  vector<long long> mod_two(n + 1, 1);
  for (int i = 1; i <= n; i++) mod_two[i] = mod_two[i - 1] * 2 % mod;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    long long c = gcd(a, b);
    if (c != 0) {
      a /= c;
      b /= c;
    }
    if (a < 0) {
      a = -a;
      b = -b;
    }
    if (a == 0 && b == 0) tmp_ans++;
    if (a == 0 || b == 0) {
      if (a == 0) a_zero++;
      if (b == 0) b_zero++;
    } else
      iwashi.insert({a, b});
  }
  long long ans = 1;
  ans *= (mod + mod_two[a_zero] + mod_two[b_zero] - 1) % mod;
  ans %= mod;
  auto ptr = iwashi.begin();
  while (ptr != iwashi.end()) {
    a = (*ptr).first;
    b = (*ptr).second;
    int num = iwashi.count({a, b});
    int count = 0;
    count += iwashi.count({b, -a});
    iwashi.erase({b, -a});
    count += iwashi.count({-b, a});
    iwashi.erase({-b, a});
    ans *= (mod + mod_two[num] + mod_two[count] - 1) % mod;
    ans %= mod;
    ptr++;
  }
  ans += (mod + mod_two[tmp_ans] - 1) % mod;
  ans %= mod;
  cout << (mod + ans - 1) % mod << endl;
  return (0);
}
