#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<cmath>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<algorithm>
#include<bitset>
#include<complex>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll power(ll a,ll b)
{
	return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;
}
ll n,a,b,ans=1,MOD=mod-1;
map<pair<ll,ll>,pair<ll,ll>>m;
int main()
{
    cin>>n;
    for (ll i=0;i<n;++i)
	{
        cin>>a>>b;
        if (!a && !b)
			++MOD;
        else
		{
            ll g=__gcd(a,b);
            a/=g,b/=g;
            if (b<0) a=-a,b=-b;
            if (a<=0) m[{b,-a}].second++;
            else m[{a,b}].first++;
        }
    }
    for (auto u:m) ans=ans*(power(2,u.second.first)+power(2,u.second.second)-1+mod)%mod;
    cout<<(ans+MOD)%mod;
}