def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

from collections import defaultdict, deque
from sys import exit
import math
import copy
from bisect import bisect_left, bisect_right
from heapq import *
import sys
# sys.setrecursionlimit(1000000)
INF = 10 ** 17
MOD = 998244353
from fractions import *
def inverse(f):
    return Fraction(f.denominator,f.numerator)


def combmod(n, k, mod=MOD):
    ret = 1
    for i in range(n - k + 1, n + 1):
        ret *= i
        ret %= mod

    for i in range(1, k + 1):
        ret *= pow(i, mod - 2, mod)
        ret %= mod

    return ret

def solve():
    n = getN()
    iwashis = []
    for i in range(n):
        iwashis.append(getList())

    fr = defaultdict(int)
    for iw in iwashis:
        if iw[0] != 0:
            fr[Fraction(iw[1], iw[0])] += 1
        else:
            fr["INF"] += 1

    used = defaultdict(int)
    ans = 1
    for k, v in fr.items():
        if k == "INF":
            pass
        elif k not in used:
            if - inverse(k) in fr:
                ans *= pow(2, v, MOD) + pow(2, fr[- inverse(k)], MOD) - 1
                ans %= MOD
            else:
                ans *= pow(2, v, MOD)
                ans %= MOD
            used[- inverse(k)] += 1
        elif k == 0:
            if "INF" in fr:
                ans *= pow(2, v, MOD) + pow(2, fr["INF"], MOD) - 1
                ans %= MOD
            else:
                ans *= pow(2, v, MOD)
                ans %= MOD
        # print(k, v, ans, -inverse(k))
    # print(fr)
    print((ans-1) % MOD)
    # bun.sort()
    # ans = 0
    # for iw in iwashis:
    #     cur = iw[0]/ iw[1]
    #     ans += bisect_right(bun, -cur) - bisect_left(bun, -cur)
    #     print(iw, cur, ans)
    #
    # print(ans/2)
    # print(bun)
    #
    # tmp = 0
    # for i in range(n-1):
    #     for j in range(1+1, n):
    #         iw1, iw2 = iwashis[i], iwashis[j]
    #         if iw1[0] * iw2[0] + iw1[1] + iw2[1] == 0:
    #             print(iw, iw2)
    #             tmp += 1
    #
    # print(tmp)
def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    solve()

