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

ll power(int a, int b)
{
  ll res = 1;
  for (int i = 0; i < b; i++)
  {
    res *= a;
    res %= MOD;
  }
  return res;
}

int main()
{
  int n;
  cin >> n;
  int z = 0;
  map<pair<ll, ll>, pair<int, int>> mp;
  for (int i = 0; i < n; i++)
  {
    ll a, b, gcd;
    cin >> a >> b;
    gcd = __gcd(a, b);
    if (gcd == 0)
    {
      z++;
    }
    else
    {
      a /= gcd;
      b /= gcd;
      if (a <= 0)
      {
        mp[make_pair(b, -a)].second++;
      }
      else
      {
        mp[make_pair(a, b)].first++;
      }
    }
  }

  ll ans = 1;
  for (auto p : mp)
  {
    int v1 = p.second.first, v2 = p.second.second;
    ans *= (power(2, v1) + power(2, v2) - 1 + MOD) % MOD;
    ans %= MOD;
  }
  cout << (ans + z - 1 + MOD) % MOD << endl;
}