#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ull unsigned long long
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vi>
#define mp make_pair
#define hell 1000000007
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define all(a) a.begin(),a.end()
#define ign cin.ignore();

#define o_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define o_setll tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
//to delete an element
//s.erase(s.find_by_order(s.order_of_key(ele)));
//where s is the name of the ordered_set
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

using namespace std;
using namespace __gnu_pbds;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef MY_PROJECT
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

inline int fast_expo(int base,int power,int modulo=hell){
    base%=modulo;
    if (base<0) base+=modulo;
    ll x=base,cnt=power,ans=1;
    while(cnt){
        if (cnt&1) ans=(ans*x)%modulo;
        x=(x*x)%modulo;
        cnt>>=1;
    }
    return ans;
}
inline int inv(int base,int modulo=hell){
    return fast_expo(base,modulo-2,modulo);
}

int main()
{
    IOS
    int n;
    cin>>n;
    map<pll,int> m;
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        ll a,b;
        cin>>a>>b;
        if(b<0){
            a=a*-1ll;
            b=b*-1ll;
        }
        if(a==0&&b==0){
            cnt++;
            continue;
        }
        ll g=gcd(a,b);
        a=a/g;
        b=b/g;
        m[mp(a,b)]++;
    }
    set<pll> skip;
    ll mult=1;
    for(auto u:m){
        pll pairr = u.first;
        if(skip.find(pairr)!=skip.end())
            continue;
        pll conjugate = mp(-1ll*pairr.second,pairr.first);
        if(conjugate.second<0){
            conjugate.first=conjugate.first*-1ll;
            conjugate.second=conjugate.second*-1ll;
        }
        if(m.find(conjugate)!=m.end()){
            skip.insert(conjugate);
            ll num1=fast_expo(2,m[pairr]);
            ll num2=fast_expo(2,m[conjugate]);
            mult=(mult*((num1+num2-1ll)%hell))%hell;
        }
        else{
            ll num1=fast_expo(2,m[pairr]);
            mult=(mult*num1)%hell;
        }
    }
    ll ways=fast_expo(2,cnt);
    if(cnt==0)
        ways=0;
    mult=(mult-1ll+hell)%hell;
    mult=(mult+ways)%hell;
    cout<<mult;
    return 0;
}
