#include <bits/stdc++.h>
using namespace std;
using Pii = pair<int, int>;
using Pll = pair<long long, long long>;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
                  'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                  's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};
const long long mod = 1e9 + 7;
const long long MOD = 1e9 + 7;
long long Pow(long long x, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 0)
    return Pow(x * x % MOD, n / 2);
  else
    return (x * Pow(x, n - 1)) % MOD;
}
int main() {
  long long n;
  cin >> n;
  map<Pll, long long> mp;
  for (long long i = (0), i_len = (n); i < i_len; ++i) {
    long long a, b;
    cin >> a >> b;
    long long k = gcd(abs(a), abs(b));
    a /= k, b /= k;
    mp[Pll(a, b)]++;
  }
  vector<long long> anslis;
  for (auto &p : mp) {
    Pll pp = p.first;
    long long a = pp.first, b = pp.second;
    long long count = p.second;
    count += mp[Pll(-1 * b, a)];
    count += mp[Pll(b, -1 * a)];
    mp[Pll(-1 * b, a)] = 0;
    mp[Pll(b, -1 * a)] = 0;
    mp[Pll(a, b)] = 0;
    if (count != 0) anslis.push_back(count);
  }
  long long ans = Pow(2, n) - 1;
  for (long long i = (0), i_len = (anslis.size()); i < i_len; ++i) {
    if (anslis[i] >= 2) {
      long long k = Pow(2, anslis[i]) % MOD;
      k -= (anslis[i] + 1);
      k = (k * Pow(2, anslis.size())) % MOD;
      ans = (ans + MOD - k) % MOD;
    }
  }
  cout << ans << endl;
}
