#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 1000000007;

int64_t pow_mod(int64_t x, int64_t n)
{
  int64_t res = 1;
  if (n > 0)
  {
    res = pow_mod(x, n / 2);
    if (n % 2 == 0)
      res = (res * res) % MOD;
    else
      res = (((res * res) % MOD) * x) % MOD;
  }
  return res;
}

int main()
{
  int64_t N, x, y;
  int64_t zero = 0;
  cin >> N;
  map<pair<int64_t, int64_t>, pair<int64_t, int64_t>> mp;
  for (int i = 0; i < N; i++)
  {
    cin >> x >> y;
    if (x == 0 && y == 0)
    {
      zero++;
      continue;
    }
    int64_t g = gcd(x, y);
    x /= g;
    y /= g;
    if (y < 0)
    {
      x = -x;
      y = -y;
    }
    if (y == 0 && x < 0)
    {
      x = -x;
      y = -y;
    }
    bool rot90 = (x <= 0);
    if (rot90)
    {
      int64_t tmp = x;
      x = y;
      y = -tmp;
    }
    if (rot90)
      mp[{x, y}].first++;
    else
      mp[{x, y}].second++;
  }

  int64_t ans = 1;
  for (auto p : mp)
  {
    int64_t s = p.second.first;
    int64_t t = p.second.second;
    int64_t now = 1;
    now = (now + pow_mod(2, s)) % MOD - 1;
    now = (now + pow_mod(2, t)) % MOD - 1;
    ans = (ans * now) % MOD;
  }
  ans -= 1;
  ans += zero;
  cout << ans % MOD << endl;
}