import functools
n, k = map(int, input().split())
s = set()
for i in range(k):
    k1, k2 = map(int, input().split())
    s.add(k1)
    s.add(k2)
@functools.lru_cache(None)
def dp(cur):
    ret = 0
    if cur == n:
        ret +=  1
    for i in s:
        temp = i + cur
        if temp > n:
            continue
        else:
            ret += dp(temp)
    return ret
print(dp(1)%(998244353))