Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

"""
A^5 - B^5
= (A - B)(A^4 + A^3*B + A^2*B^2 + A*B^3 + B^4)
= (A - B){(A + B) * (A^3 + B^3) + A^2*B^2}
= (A - B){(A + B)^2 * (A^2 - AB + B^2) + A^2*B^2}

(A + B)^2 > 0, (A^2 - AB + B^2) > 0, A^2*B^2 > 0
-> (A - B) > 0
"""


def main():
    print(*solve())


def solve():
    X = int(input())
    N = 10 ** 9 + 7

    if X % 2:
        step = 1
    else:
        step = 2  # if X is odd number, (A - B) also must be odd.

    for x in range(1, N, step):  # x means (A - B)
        if X % x:  # X must be divided by (A - B)
            continue

        for a in range(N):
            b = a - x

            diff = X - (a ** 5 - b ** 5)
            if diff == 0:
                return a, b

            if diff < 0 < b:
                break


if __name__ == "__main__":
    main()


### FIXED CODE ###

"""
A^5 - B^5
= (A - B)(A^4 + A^3*B + A^2*B^2 + A*B^3 + B^4)
= (A - B){(A + B) * (A^3 + B^3) + A^2*B^2}
= (A - B){(A + B)^2 * (A^2 - AB + B^2) + A^2*B^2}

-> (A + B)^2 > 1, (A^2 - AB + B^2) > 1, A^2*B^2 > 1.
"""


def main():
    print(*solve())


def solve():
    X = int(input())

    for a in range(-1000, 1000):
        for b in range(-1000, 1000):
            if a ** 5 - b ** 5 == X:
                return a, b


if __name__ == "__main__":
    main()
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import math

n = int(input())+1
a = int(0)
for i in range(1, n):
  for j in range(1, n):
    for k in range(1, n):
      a = a + math.gcd(i,math.gcd(j,k))
print("{}".format(a))


### FIXED CODE ###

# -*- coding: utf-8 -*-
import math

n = int(input())+1
a = int(0)
for i in range(1, n):
  for j in range(1, n):
    b = math.gcd(i,j)
    for k in range(1, n):
      a = a + math.gcd(b,k)
print("{}".format(a))
### BUGGY CODE ###

n, a = map(int, input().split())
x = list(map(int, input().split()))
X = max(max(x), a)
dp = [[[0] * (n * X + 1) for i in range(n + 1)] for j in range(n + 1)]
dp[0][0][0] = 1
for i in range(1, n + 1):
    for j in range(n + 1):
        for s in range(n * X + 1):
            if s < x[i - 1]:
                dp[i][j][s] = dp[i - 1][j][s]
            elif j >= 1 and x[i - 1] <= s:
                dp[i][j][s] = dp[i - 1][j][s] + dp[i - 1][j - 1][s - x[i - 1]]

num = 0
for i in range(1, n + 1):
    num += dp[n][i][i * a]

print(num)

### FIXED CODE ###

n, a = map(int, input().split())
x = list(map(lambda q: int(q) - a, input().split()))
X = max(max(x), a)
N = 2 * n * X
dp = [[0] * (N + 1) for i in range(n + 1)]
dp[0][n * X] = 1
for i in range(1, n + 1):
    for j in range(N + 1):
        if j - x[i - 1] < 0 or j - x[i - 1] > N:
            dp[i][j] = dp[i - 1][j]
        elif j - x[i - 1] <= N:
            dp[i][j] = dp[i - 1][j] + dp[i - 1][j - x[i - 1]]

print(dp[n][n * X] - 1)
### BUGGY CODE ###

def main():
    from math import gcd
    MINFact = [-1] * (10**6 + 10)
    MINFact[0] = 0
    MINFact[1] = 1

    def Eratosthenes(sup: int) -> set:
        primes = [True for i in range(sup+1)]
        primes[0] = False
        primes[1] = False
        for i in range(2, sup+1):
            if sup < i*i:
                break
            if primes[i]:
                MINFact[i] = i
                mul = 2
                while i*mul <= sup:
                    primes[i*mul] = False
                    if MINFact[i*mul] == -1:
                        MINFact[i*mul] = i
                    mul += 1

    def prime_factor(n):
        while n != 1:
            prime = MINFact[n]
            while MINFact[n] == prime:
                n //= prime
            B[prime] += 1

    _ = int(input())
    A = [int(i) for i in input().split()]
    g = A[0]
    for a in A:
        g = gcd(g, a)
    Eratosthenes(10**6 + 5)
    B = [0]*(10**6 + 5)
    for a in A:
        prime_factor(a)
    # 素因数分解したのをBにいれる
    # 1より大きいのがあったら gcd != 1 のペアが存在する
    if g != 1:
        print("not coprime")
    elif max(B) <= 1:
        print("pairwise coprime")
    else:
        print("setwise coprime")


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from math import gcd
    MINFact = [-1] * (10**6 + 10)
    MINFact[0] = 0
    MINFact[1] = 1

    def Eratosthenes(sup: int) -> set:
        primes = [True for i in range(sup+1)]
        primes[0] = False
        primes[1] = False
        for i in range(2, sup+1):
            if primes[i]:
                MINFact[i] = i
                mul = 2
                while i*mul <= sup:
                    primes[i*mul] = False
                    if MINFact[i*mul] == -1:
                        MINFact[i*mul] = i
                    mul += 1

    def prime_factor(n):
        while n != 1:
            prime = MINFact[n]
            while MINFact[n] == prime:
                n //= prime
            B[prime] += 1

    _ = int(input())
    A = [int(i) for i in input().split()]
    g = A[0]
    for a in A:
        g = gcd(g, a)
    Eratosthenes(10**6 + 5)
    B = [0]*(10**6 + 5)
    for a in A:
        prime_factor(a)
    # 素因数分解したのをBにいれる
    # 1より大きいのがあったら gcd != 1 のペアが存在する
    if g != 1:
        print("not coprime")
    elif max(B) <= 1:
        print("pairwise coprime")
    else:
        print("setwise coprime")


if __name__ == '__main__':
    main()
### BUGGY CODE ###

N, M, P = map(int, input().split())
E = [None] * M
for i in range(M):
    a, b, c = map(int, input().split())
    E[i] = (a - 1, b - 1, P - c)

d = [float("inf") for _ in range(N)]
d[0] = 0
for i in range(2*N):
    for f, t, w in E:
        if d[f] != float("inf") and d[t] > d[f] + w:
            d[t] = d[f] + w
            if i >= N:
                d[t] = -float("inf")
    if i == N-1:
        dN = d[-1]
if dN != d[-1]:
    print(-1)
elif dN > 0:
    print(0)
else:
    print(-dN)

### FIXED CODE ###

N, M, P = map(int, input().split())
E = [None] * M
for i in range(M):
    a, b, c = map(int, input().split())
    E[i] = (a - 1, b - 1, P - c)
INF = float("inf")
d = [INF for _ in range(N)]
d[0] = 0
for i in range(2*N):
    for f, t, w in E:
        if d[t] > d[f] + w:
            d[t] = d[f] + w
            if i >= N:
                d[t] = -INF
    if i == N-1:
        dN = d[-1]
if dN != d[-1]:
    print(-1)
elif dN > 0:
    print(0)
else:
    print(-dN)
### BUGGY CODE ###

n= int(input())
s = input()
R = []
G = []
B = []
import bisect
def func(l1,l2,l3):
  res =0
  for i in l1:
    for j in l2:
      if i>j:
        continue
      a = l3[bisect.bisect_left(l3,j):]
      res += len(a)
      if j*2-i in a:
        res -=1
  return res

for i in range(n):
  if s[i] == 'R':
    R.append(i+1)
  elif s[i] == 'G':
    G.append(i+1)
  else:
    B.append(i+1)
    
ans = func(R,G,B)+func(R,B,G)+func(G,R,B)+func(G,B,R) + func(B,R,G)+func(B,G,R)
print(ans)
  

### FIXED CODE ###

import sys
input = sys.stdin.readline

n= int(input())
s = input()
R = []
G = []
B = []
import bisect
def func(l1,l2,l3,l3set):
  res =0
  for i in l1:
    for j in l2[bisect.bisect_left(l2,i):]:
      a = l3[bisect.bisect_left(l3,j):]
      res += len(a)
      if j*2-i in l3set:
        res -=1
  return res

for i in range(n):
  if s[i] == 'R':
    R.append(i+1)
  elif s[i] == 'G':
    G.append(i+1)
  else:
    B.append(i+1)
    
    
R_set = set(R)
G_set = set(G)
B_set = set(B)
ans = func(R,G,B,B_set)+func(R,B,G,G_set)+func(G,R,B,B_set)+func(G,B,R,R_set) + func(B,R,G,G_set)+func(B,G,R,R_set)
print(ans)
### BUGGY CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os, pdb
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def perr(s): return print(s, file=sys.stderr)

ans = []
lines_dict =None
d=None
def main():
    global AB, PX, T
    if 'LOCAL' in os.environ:
        N = 2* 10** 5
        Q = 2 * 10 ** 5
        AB = [[i, i + 1] for i in range(1, N)]
        PX = [[i, 10] for i in range(Q)]
    else:
        N, Q = LI()
        AB = tuple()
        T = [[] for _ in range(N+1)]
        PX = [0] * (N+1)
        for i in range(1, N+1):
            PX[i] = 0
        for i in range(N-1):
            a, b = LI()
            AB += (a, b)
            T[a] += [b]
            T[b] += [a]

        for i in range(Q):
            p, x = LI()
            PX[p] += x

        dfs(1, -1)
        for i in PX[1:]:
            print(i, end=' ')
        #  ans = [0 for _ in range(N)]

def dfs(parent, parent_parent):

    for node in T[parent]:
        if node != parent_parent:

            PX[node] += PX[parent]
            dfs(node, parent)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os, pdb
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def perr(s): return print(s, file=sys.stderr)

if 'LOCAL' in os.environ:
    N = 2* 10** 5
    Q = 2 * 10 ** 5
    AB = [[i, i + 1] for i in range(1, N)]
    PX = [[i, 10] for i in range(Q)]
else:
    N, Q = LI()
    AB = []
    PX = []
    for i in range(N-1):
        AB.append(LI())

    for i in range(Q):
        PX.append(LI())


"""
そもそも各頂点の部分木をdictに入れましょうか？
参照するような形で。
2には3
3には4,5
4,5はNoneだと、参照しやすいか？

カウントを若い順にやっていく
"""
AB = sorted(AB, key=lambda x: x[0])
perr('AB')
perr(AB)
d = {}
for p, x in PX:
    if p not in d.keys():
        d[p] = 0
    d[p] += x
for a, b in AB:
    if b not in d.keys():
        d[b] = 0
    if a not in d.keys():
        d[a] = 0
    d[b] += d[a]
for i in range(1, N+1):
    print(d[i], end=' ')
### BUGGY CODE ###

N, W = list(map(int, input().split()))

weight = []
value = []

for i in range(N):
    w, v = list(map(int, input().split()))
    weight.append(w)
    value.append(v)


# print('weight')
# print(weight)
# print('value')
# print(value)


def dfs(index, v, w):
    x = 0
    if (index >= N):
        return v
    if (w + weight[index] <= W):
        x = dfs(index+1, v+value[index], w+weight[index])
    y = dfs(index+1,v,w)

    return max(x, y)




ans = dfs(0, 0, 0)

print(ans)


### FIXED CODE ###

N, W = list(map(int, input().split()))

weight = []
value = []

for i in range(N):
    w, v = list(map(int, input().split()))
    weight.append(w)
    value.append(v)

def dfs(index, v, w):
    x = 0
    if (index >= N):
        return v
    if (w + weight[index] <= W):
        x = dfs(index+1, v+value[index], w+weight[index])
    y = dfs(index+1,v,w)

    return max(x, y)


# ans = dfs(0, 0, 0)

dp = []

for i in range(N+1):
    dp.append([])
    for j in range(W+1):
        dp[i].append(0)
    
# max value = dp[何個まで見たか][現在の重さ]
for i in range(N):
    for j in range(W+1):
        # if j+weight[i] <= W:
        #     dp[i+1][j+weight[i]] = max(dp[i][j+weight[i]], dp[i][j]+value[i])
        # else:
        #     dp[i+1][j] = dp[i][j]
        # if 
        if j >= weight[i]:
            dp[i+1][j] = max(dp[i][j-weight[i]]+value[i], dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]


print(dp[N][W])
### BUGGY CODE ###

N = int(input())
S = list(input())

Rindex = set(i for i in range(N) if S[i] == 'R')
Gindex = set(i for i in range(N) if S[i] == 'G')
Bindex = set(i for i in range(N) if S[i] == 'B')

def findijk(l1, l2, l3):
    ret = 0
    for i in l1:
        for j in l2:
            if i > j:continue
            for k in l3:
                if j > k or j - i == k - j:continue
                ret += 1
    return ret

ans = 0

ans += findijk(Rindex, Gindex, Bindex)
ans += findijk(Bindex, Rindex, Gindex)
ans += findijk(Gindex, Bindex, Rindex)
ans += findijk(Rindex, Bindex, Gindex)
ans += findijk(Gindex, Rindex, Bindex)
ans += findijk(Bindex, Gindex, Rindex)

print(ans)

### FIXED CODE ###

from collections import Counter

N = int(input())
S = input()
cnt = Counter(S)

ans = cnt['R']*cnt['G']*cnt['B']
#まずansに要請１を満たす(i, j, k)の組の数を入れておき，ここから，要請２を満たさないものを除いていく。

for i in range(N-2):
    for j in range(i+1, N-1):
        k = j + (j - i)
        #kは　j - i = k - j を満たす。ただし，（i, j, k）が要請１を満たしているとは限らない。
        if k < N:
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -= 1

print(ans)
### BUGGY CODE ###

l = list(map(int,input().split()))
a = l[0]
b = l[1]
x = l[2]
count = 0
for i in range(a,b+1):
	if i%x == 0:
		count+=1

print(count)


### FIXED CODE ###

l = list(map(int,input().split()))
a = l[0]
b = l[1]
x = l[2]
if a%x == 0:
	print(b//x-a//x +1)
else:
	print(b//x-a//x)
### BUGGY CODE ###

import sys
input = sys.stdin.readline


def main():
    N = int(input())
    P = list(map(float, input().split()))
    dp = [[0]*(N+1) for _ in range(N+1)]  # i 枚目のコインを投げたとき j 枚が表の確率

    dp[1][0] = 1 - P[0]
    dp[1][1] = P[0]
    for i in range(2, N+1):
        for j in range(i+1):
            dp[i][j] = dp[i-1][j-1] * P[i-1] + dp[i-1][j] * (1 - P[i-1])

    ans = 0
    for i, p in enumerate(dp[N]):
        if i >= (N+1)//2:
            ans += p
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    N = int(input())
    P = list(map(float, input().split()))
    dp = [[0]*(N+1) for _ in range(N+1)]  # i 枚目のコインを投げたとき j 枚が表の確率

    dp[1][0] = 1 - P[0]
    dp[1][1] = P[0]
    for i in range(2, N+1):
        for j in range(i+1):
            dp[i][j] = dp[i-1][j-1] * P[i-1] + dp[i-1][j] * (1 - P[i-1])

    ans = 0
    for i, p in enumerate(dp[N]):
        if i >= (N+1)//2:
            ans += p
    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

N, K = map(int, input().split())
h = [int(i) for i in input().split()]
INF = 10**9

c = [INF] * N
c[0] = 0

for i in range(N):
  tmp = []
  for j in range(max(0, i-K), i):
    c[i] = min(c[j] + abs(h[i] - h[j]), c[i])
print(c[-1])

### FIXED CODE ###

N, K = map(int, input().split())
h = [int(i) for i in input().split()]
INF = 10**9

c = [INF] * N
c[0] = 0

for i in range(N):
  tmp = []
  for j in range(1, min(K, i)+1):
    c[i] = min(c[i-j] + abs(h[i] - h[i-j]), c[i])
print(c[-1])
### BUGGY CODE ###

n=input().split()
li=[]
a=map(int,input().split())
flag=0

for i in a:
    if i in li:
        print("NO")
        flag=1
        break
    else:
        li.append(i)

if flag==0:
    print("YES")

### FIXED CODE ###

n=input().split()
li=[]
a=list(map(int,input().split()))

p=set(a)

if len(a)==len(p):
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

n=int(input())
r=1
for i in range(1,n+1):
    r=r*i
print(r%(10**9+7))

### FIXED CODE ###

n=int(input())
r=1
for i in range(1,n+1):
    r=r*i%(10**9+7)
print(r)
### BUGGY CODE ###

MOD = 998244353


def solve(n, s, a_list):
    dp = [[0] * 3001 for _ in range(n + 1)]
    dp[0][0] = 1
    for i in range(n):
        a = a_list[i]
        for v in range(3001):
            dp[i + 1][v] = (dp[i][v] * 2) % MOD
        for v in range(3001):
            if v + a > 3000:
                break
            dp[i + 1][v + a] = (dp[i + 1][v + a] + dp[i][v]) % MOD
    # print(dp[n])
    return dp[n][s]


def main():
    n, s = map(int, input().split())
    a_list = list(map(int, input().split()))
    res = solve(n, s, a_list)
    print(res)


def test():
    assert solve(3, 4, [2, 2, 4]) == 6
    assert solve(5, 8, [9, 9, 9, 9, 9]) == 0
    assert solve(10, 10, [3, 1, 4, 1, 5, 9, 2, 6, 5, 3]) == 3296


if __name__ == "__main__":
    test()
    main()


### FIXED CODE ###

MOD = 998244353


def solve(n, s, a_list):
    dp = [[0] * 3001 for _ in range(n + 1)]
    dp[0][0] = 1
    for i in range(n):
        a = a_list[i]
        for v in range(3001):
            dp[i + 1][v] = (dp[i][v] * 2) % MOD
        for v in range(3001):
            if v + a > 3000:
                break
            dp[i + 1][v + a] = (dp[i + 1][v + a] + dp[i][v]) % MOD
    # print(dp[n])
    return dp[n][s]


def main():
    n, s = map(int, input().split())
    a_list = list(map(int, input().split()))
    res = solve(n, s, a_list)
    print(res)


def test():
    assert solve(3, 4, [2, 2, 4]) == 6
    assert solve(5, 8, [9, 9, 9, 9, 9]) == 0
    assert solve(10, 10, [3, 1, 4, 1, 5, 9, 2, 6, 5, 3]) == 3296


if __name__ == "__main__":
    test()
    main()
### BUGGY CODE ###

def main():
    N = int(input().strip())
    init_array=[]
    stack=[]
    [init_array.append(int(i)) for i in (input().split())]
    for v in init_array:
        if len(stack)==0:
            stack.append(v)
            continue
        else:
            stack.append(v)
            stack.reverse()
    ans_list=[str(num) for num in stack]
    ans=' '.join(ans_list)
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import deque
def main3():
    d = deque()
    rd= deque()
    N = int(input().strip())
    for n in input().split():
        if len(rd)%2!=0:
            d.append(n)
            rd.appendleft(n)
        else:
            rd.append(n)
            d.appendleft(n)
    if N % 2 ==0:
        print(*rd)
    else:
        print(*d)

if __name__ == "__main__":
    main3()
### BUGGY CODE ###

import sys

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

def main():
	N, M = MAP()
	A = MAP()
	append = A.append
	for i in range(M):
		b, c = MAP()
		for _ in range(b):
			append(c)
	
	A.sort(reverse=True)
	print(sum(A[:N]))

if __name__ == '__main__':
	main()

### FIXED CODE ###

import sys
from heapq import heapify, heappop
from operator import itemgetter

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

def main():
	N, M = MAP()
	A = MAP()
	BC = [MAP() for _ in range(M)]
	
	BC.sort(key= itemgetter(1), reverse=True)
	
	heapify(A)
	
	ans = 0
	
	fin = False
	for b, c in BC:
		#print(A, b, c)
		for _ in range(b):
			a = A[0]
			if a>c:
				fin = True
				break
			else:
				heappop(A)
				ans += c
				N -= 1
				if N == 0:
					fin = True
					break
		if fin:
			break
	
	print(ans+sum(A))

if __name__ == '__main__':
	main()
### BUGGY CODE ###

S=input()
Q=int(input())
reverse=False
for _ in range(Q):
    inp=input()
    if inp[0]=="1":
        reverse= not reverse
    elif inp[0]=="2":
        if (inp[2]=="1" and not reverse) or (inp[2]=="2" and reverse):
            S=inp[4]+S
        else:
            S=S+inp[4]
if reverse:
    S=S[::-1]
print(S)

### FIXED CODE ###

S=input()
Q=int(input())
reverse=False
front=""
rear=""
for _ in range(Q):
    inp=input()
    if inp[0]=="1":
        reverse= not reverse
    elif inp[0]=="2":
        if (inp[2]=="1" and not reverse) or (inp[2]=="2" and reverse):
            front=inp[4]+front
        else:
            rear=rear+inp[4]
ans=front+S+rear
if reverse:
    ans=ans[::-1]
print(ans)
### BUGGY CODE ###

N = int(input())
S = list(input())

ans = 0

for i in range(1000):
    filled_num = str(i).zfill(3)
    target = list(filled_num)
    ok1 = False
    ok2 = False
    ok3 = False

    for k in range(len(S)):
        if S[k] == target[2] and ok2:
            ok3 = True
        elif S[k] == target[1] and ok1:
            ok2 = True
        elif S[k] == target[0]:
            ok1 = True

        if ok3:
            break
    if ok3:
        ans += 1
print(ans)


### FIXED CODE ###

def test(original: list, nums: str, index: int,
         remain_count: int, results: set, results_1, results_2):
    # 3桁抽出したら終了
    if len(nums) == 1:
        if nums in results_1:
            return
        results_1.add(nums)
    if len(nums) == 2:
        if nums in results_2:
            return
        results_2.add(nums)
    if len(nums) == 3:
        # print("".join(array))
        results.add(nums)
        return
    # 最終桁に到達したら終了
    if index == len(original):
        return
    for i in range(index, len(original), 1):
        test(
            original,
            nums + original[i],
            i + 1,
            remain_count,
            results,
            results_1,
            results_2)

    # この桁を抽出対象としないパターン
    # test(original, array[:], index + 1, remain_count - 1, results)


N = int(input())
S = list(input())

results = set()
results_1 = set()
results_2 = set()

# N個の要素
# N-3個を削除
# 3個の組み合わせが何通りあるか？
test(S, "", 0, N - 3, results, results_1, results_2)

print(len(results))
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
import fractions
from functools import reduce
mod = 10**9+7

def gcd(*numbers):
    return reduce(fractions.gcd,numbers)
def lcm_bace(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm(*numbers):
    return reduce(lcm_bace,numbers,1)

A_lcm = lcm(*A)
ans = 0
for i in A:
    ans += (A_lcm//i)%mod
print(ans%mod)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
import fractions
mod = 10**9+7
lcm = A[0]
for i in range(1,N):
    lcm = lcm*A[i]//fractions.gcd(lcm,A[i])
ans = 0
for i in range(N):
    ans += lcm*pow(A[i],mod-2,mod)
print(ans%mod)
### BUGGY CODE ###

from math import floor, ceil
from numpy import array
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
L = array([0 for i in range(N+2)])

for _ in range(K):
    for i, a in enumerate(A):
        l = max(0, ceil(i+1-a-0.5))
        r = min(N+2, floor(i+1+a+0.5)+1)
        L[l:r] += 1
    for i in range(N):
        A[i] = L[i+1]
    L = array([0 for i in range(2*N+2)])
    if all([a == N for a in A]):
        break
print(*A)

### FIXED CODE ###

from itertools import accumulate
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

for _ in range(K):
    S = [0] * (N + 1)
    for i, a in enumerate(A):
        l = min(N-1, max(0, i-a))
        r = min(N-1, i+a)
        S[l] += 1
        S[r+1] -= 1
    A = list(accumulate(S))[:-1]
    if all([a == N for a in A]):
        break
print(*A)
### BUGGY CODE ###

R,G,B,n=map(int, input().split())
ans=0

for r in range(n+1):
    if r%R==0:
        for g in range(n+1-r):
            b = n-r-g
            if b%B==0 and r%R==0 and g%G==0:
                ans+=1

print(ans)


### FIXED CODE ###

R,G,B,n=map(int, input().split())
ans=0

for r in range(n+1):
    if r%R==0:
        for g in range(n+1-r):
            b = n-r-g
            if b%B==0 and r%R==0 and g%G==0:
                ans+=1

print(ans)
### BUGGY CODE ###

n, k = map(int, input().split())
mod = 998244353

s = [] 
for i in range(k):
    lk = list(map(int, input().split()))
    for j in range(lk[0], lk[1] + 1):
        s.append(j)

dp = [0 for _ in range(n)]
dp[0] = 1

for i in range(1,n):
    for j in s:
        if i - j >= 0:
            dp[i] += dp[i-j]

print(dp[-1]%mod)

### FIXED CODE ###

n, k = map(int, input().split())
s = [] 
mod = 998244353

for i in range(k):
    l, r = map(int, input().split())
    s.append([l, r])

dp = [0 for _ in range(n+1)]
dp[1] = 1
dpsum = [0 for _ in range(n+1)]
dpsum[1] = 1

for i in range(2,n+1):
    for l, r in s:
        li = max(i-r,1)
        ri = max(i-l,0)
        dp[i] += (dpsum[ri] - dpsum[li-1])%mod
    dpsum[i] = (dpsum[i-1] + dp[i])%mod

print(dp[n]%mod)