#include <bits/stdc++.h>
const long INF = (1l << 30);
const long LINF = (1l << 60);
const long MOD = 1000000007;
long n;
std::map<std::pair<long, long>, long> mp;
std::map<std::pair<long, long>, std::pair<long, long> > mp2;
long power(long a, long b, const long MOD) {
  a %= MOD;
  if (b == 0) {
    return 1l;
  } else if (b % 2 == 1) {
    return a * power(a, b - 1, MOD) % MOD;
  } else {
    long r = power(a, b / 2, MOD);
    return r * r % MOD;
  }
}
long gcd(long num1, long num2) {
  if (num1 < 0) {
    num1 = -num1;
  }
  if (num2 < 0) {
    num2 = -num2;
  }
  if (num2 > num1) {
    std::swap(num1, num2);
  }
  if (num2 == 0) {
    return num1;
  } else {
    return gcd(num2, num1 % num2);
  }
}
std::pair<long, long> modify(std::pair<long, long> vec) {
  long a = vec.first;
  long b = vec.second;
  if (a == 0) {
    if (b != 0) {
      return std::pair<long, long>(0, 1);
    } else {
      return std::pair<long, long>(0, 0);
    }
  } else if (b == 0) {
    return std::pair<long, long>(1, 0);
  }
  long g = gcd(a, b);
  a /= g;
  b /= g;
  if (b == 0) {
    if (a < 0) {
      a = -a;
    }
  } else if (b < 0) {
    a = -a;
    b = -b;
  }
  return std::pair<long, long>(a, b);
}
bool is_quad(std::pair<long, long> v) {
  if (v == std::pair<long, long>(0, 0)) {
    return true;
  }
  if (v.first >= 0 && v.second > 0) {
    return true;
  }
  return false;
}
std::pair<long, long> vertical(std::pair<long, long> v) {
  return modify(std::pair<long, long>(v.second, -v.first));
}
int main() {
  scanf("%ld", &n);
  for (int i = 0; i < n; i++) {
    long a, b;
    scanf("%ld%ld", &a, &b);
    mp[modify(std::pair<long, long>(a, b))]++;
  }
  for (auto it = mp.begin(); it != mp.end(); it++) {
    std::pair<long, long> v = it->first;
    long cnt = it->second;
    if (is_quad(v)) {
      mp2[v].first = cnt;
    } else {
      mp2[vertical(v)].second = cnt;
    }
  }
  long ans = 1;
  long zero = 0;
  for (auto it = mp2.begin(); it != mp2.end(); it++) {
    if (std::pair<long, long>(0, 0) == it->first) {
      zero = it->second.first;
      continue;
    }
    long x = it->second.first;
    long y = it->second.second;
    long res = (power(2, x, MOD) + power(2, y, MOD) - 1) % MOD;
    if (res < 0) {
      res += MOD;
    }
    ans *= res;
    ans %= MOD;
  }
  printf("%ld\n", (ans - 1 + zero) % MOD);
}
