Harryxun/stf_run huggingface dataset:
i = 0
takahasi = 0
while i < 4:
  if S[i:i+1] == "+":
    takahasi += 1
  else:
    takahasi -= 1
  i += 1
print(takahasi)

### FIXED CODE ###

from sys import stdin
S = str(stdin.readline().rstrip())
i = 0
takahasi = 0
while i < 4:
  if S[i:i+1] == "+":
    takahasi += 1
  elif S[i:i+1] == "-":
    takahasi -= 1
  i += 1
print(takahasi)
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 16 20:36:58 2019

@author: Yamazaki Kenichi
"""

N = int(input())
C = [int(input()) for i in range(N)]
mod = 10**9+7
T = [[0] for i in range(N+1)]
ans = [1 for i in range(N+1)]
for i in range(N): 
    if i == 0 or C[i] != C[i-1]:
        T[C[i]][0] += 1
        T[C[i]].append(i)
        if T[C[i]][0] >=2:
            ans[i] = (ans[i-1] + ans[T[C[i]][-2]])%mod
        else:
            ans[i] = ans[i-1]%mod
    else:
        ans[i] = ans[i-1]%mod
        
print(ans[N-1]%mod)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Mar 16 20:36:58 2019

@author: Yamazaki Kenichi
"""

N = int(input())
C = [int(input()) for i in range(N)]
mod = 10**9+7
T = [[0] for i in range(2*10**5+1)]
ans = [1 for i in range(N+1)]
for i in range(N): 
    if i == 0 or C[i] != C[i-1]:
        T[C[i]][0] += 1
        T[C[i]].append(i)
        if T[C[i]][0] >=2:
            ans[i] = (ans[i-1] + ans[T[C[i]][-2]])%mod
        else:
            ans[i] = ans[i-1]%mod
    else:
        ans[i] = ans[i-1]%mod
        
print(ans[N-1]%mod)
n = int(input())

a = [int(input()) for i in range(n)]

for i in range(n):
    x = max(a[:i])
    y = max(a[i + 1:])
    print(max(x,y))


### FIXED CODE ###


n = int(input())
a = []
y = 0
for i in range(n):
    x = int(input())
    a.append(x)
    if y <= x:
        y = x
        m = i

a.sort(reverse = True)
a_1 = a[0]
a_2 = a[1]

if a_1 == a_2:
    for i in range(n):
        print(a_1)

else:
    for i in range(m):
        print(a_1)

    print(a_2)

    for j in range(m+1,n):
        print(a_1)
N = list(map(int, input().split()))
print((N[0]//(N[1]+N[2])*N[1] + min([N[0]%(N[1]+N[2]), N[1]]))

### FIXED CODE ###

N = list(map(int, input().split()))
print((N[0]//(N[1]+N[2]))*N[1] + min([N[0]%(N[1]+N[2]), N[1]]))
A = input()
s = 0
for i in range(1,3):
  if A[i]="1":
    s = s + 1
print(s)    

### FIXED CODE ###

A = input()
s = 0
for i in range(len(A)):
  if A[i]=="1":
    s = s + 1
print(s)
def solve():
    H, W = map(int, input().split())
    a = [list("."+input()+".") for _ in [0]*H]
    a.insert(0, list("."*(W+2)))
    a.append(list("."*(W+2)))
    result = []
 
    for y in range(1, H+1):
        for x in range(1, W+1):
            if a[y][x] == "#":
                result.append("#")
            else:
                result.append(str((a[y-1][x-1:x+2]+a[y][x-1:x+2]+a[y+1][x-1:x+2]).count("#")))
        result.append("\n")
 
    print("".join(result))
 
 
if __name__ == "__main__":
    solve()

### FIXED CODE ###

a, b, c = map(int, input().split())
if a == b:
    print(c)
elif a==c:
    print(b)
else:
    print(a)
N=int(input())
A=list(map(int,input().split()))

import collections
c=collections.Counter(A)

for i in range(N):
    print(c[i+1])

### FIXED CODE ###

R=int(input())
import math
print(2*math.pi*R)
h1,m1,h2,m2,k=map(int,input().split())
if m2<m1:
    ansh=h2-h1-1
    ansm=60+m2+m1
print(ansh*60+ansm)


### FIXED CODE ###

h1,m1,h2,m2,k=map(int,input().split())
ans2=h2*60+m2
ans1=h1*60+m1
print(ans2-ans1-k)
# coding: utf-8
a = list(input())
b = list(input())
c = list(input())
trash = a.pop(0)

def card_trash(x):
  if x == "a":
    t = a.pop(0)
  elif x == "b":
    t = b.pop(0)
  elif x == "c":
    t = c.pop(0)
  return t
  
while True:
  trash = card_trash(trash)
  if a == []:
    print("A")
    break
  elif b == []:
    print("B")
    break
  elif c == []:
    print("C")
    break

### FIXED CODE ###

# coding: utf-8
a = list(input())
b = list(input())
c = list(input())
trash = a.pop(0)

while True:
  if trash == "a":
    if len(a) == 0:
      print("A")
      break
    trash = a.pop(0)
  elif trash == "b":
    if len(b) == 0:
      print("B")
      break
    trash = b.pop(0)
  elif trash == "c":
    if len(c) == 0:
      print("C")
      break
    trash = c.pop(0)
import math
import sys
sys.setrecursionlimit(20000)
N=int(input())
edges=[[] for i in range(N+1)]
d=[-1 for i in range(N+1)]
for i in range(1,N):
	u,v,w=[int(i) for i in input().split()]
	edges[u].append([v,w])
	edges[v].append([u,w])
def kyori(u):
	for v,w in edges[u]:
		if d[v]==-1:
			d[v]=d[u]+w
			kyori(v)
d[1]=0
kyori(1)
for i in d[1:]:
	if i%2==0:
		print(1)
	else:
		print(0)

### FIXED CODE ###

import math
import sys
sys.setrecursionlimit(30000)
N=int(input())
edges=[[] for i in range(N+1)]
d=[-1 for i in range(N+1)]
for i in range(1,N):
	u,v,w=[int(i) for i in input().split()]
	edges[u].append([v,w])
	edges[v].append([u,w])
def kyori(u):
	for v,w in edges[u]:
		if d[v]==-1:
			d[v]=d[u]+w
			kyori(v)
d[1]=0
kyori(1)
for i in d[1:]:
	if i%2==0:
		print(1)
	else:
		print(0)
from pprint import pprint
from collections import Counter
from functools import lru_cache

N, X, Y = map(int, input().split())

d = [[float("inf")]*N for i in range(N)] 
for i in range(N-1):
    d[i][i+1] = 1
    d[i+1][i] = 1

d[X-1][Y-1] = 1
d[Y-1][X-1] = 1

@lru_cache(maxsize=100000)
def warshall_floyd(d):
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

wf = warshall_floyd(d)
for i in range(N):
    wf[i][i] = 0

c = Counter()
for i in range(N):
    c.update(wf[i][:i])

for i in range(1, N):
    print(c[i])



### FIXED CODE ###

from collections import Counter

N, X, Y = map(int, input().split())
g = [[float("inf")] * N for _ in range(N)]

for i in range(1, N+1):
    for j in range(1, N+1):
        g[i-1][j-1] = min([abs(j-i), abs(X-i)+1+abs(Y-j), abs(Y-i)+1+abs(X-j)])

c = Counter()
for i in range(N):
    c.update(g[i][:i])

for i in range(1, N):
    print(c[i])
d, t, s = map(int, input().split())
if s * t => d
    print(Yes)
else:
    print(No) 


### FIXED CODE ###

d, t, s = map(int, input().split( ))
if d/s <= t:
    print('Yes')
else:
    print('No')
a = int(input())
b = int(input())
c = int(input())

if a < b < c:
print("Yes")
else:
print("No")

### FIXED CODE ###

a, b, c = map(int, input().split())

if a < b < c:
    print("Yes")
else:
    print("No")
#スペース区切りの整数入力
N, M  = map(int, input().split())

if N > 2:
    N_even = N*(N - 1)/2
else:
    N_even = 0

if M > 2:
    M_even = M*(M-1)/2
else:
    M_even = 0

print(int(N_even + M_even))

### FIXED CODE ###

#スペース区切りの整数入力
N, M  = map(int, input().split())


if N >= 2:
    N_even = N*(N - 1)/2
else:
    N_even = 0

if M >= 2:
    M_even = M*(M-1)/2
else:
    M_even = 0

print(int(N_even + M_even))
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

def my_pow(base, n, mod):
    if n == 0:
        return 1
    x = base
    y = 1
    while n > 1:
        if n % 2 == 0:
            x *= x
            n //= 2
        else:
            y *= x
            n -= 1
        x %= mod
        y %= mod
    return x * y % mod
MOD = 10 ** 9 + 7

N = int(input())
X = list(input())

def popcount(n):
    ret = 0
    while n > 0:
        if n % 2 == 1:
            ret += 1
        n //= 2
    return ret

ones = X.count('1')
A_1 = 0
A_2 = 0
d = 1
for a in X[::-1]:
    A_1 += (int(a) * d) % (ones - 1)
    A_2 += (int(a) * d) % (ones + 1)
    d *= 2

for i in range(N):
    ans = 1
    total = ones
    sumA = 0
    if X[i] == '0':
        total += 1
        if total != 0:
            sumA = A_2 + my_pow(2, N - i - 1, total)
    else:
        total -= 1
        if total != 0:
            sumA = A_1 - my_pow(2, N - i - 1, total)
    if total == 0:
        print(0)
        continue
    n = sumA % total
    while n != 0:
        n = n % popcount(n)
        ans += 1
    print(ans)
    


### FIXED CODE ###

import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
X = input()

def popcount(n):
    cnt = 0
    while n > 0:
        cnt += n & 1
        n //= 2
    return cnt
def f(n):
    cnt = 0
    while n != 0:
        n = n % popcount(n)
        cnt += 1
    return cnt

ones = X.count('1')
MOD1 = ones + 1
MOD2 = ones - 1
pow1 = [1] * (len(X) + 1)
pow2 = [0] * (len(X) + 1)
if MOD2 != 0:
    pow1[0] = 1
    pow2[0] = 1
    for i in range(1, len(X) + 1):
        pow1[i] = (pow1[i - 1] * 2) % MOD1
        pow2[i] = (pow2[i - 1] * 2) % MOD2
else:
    for i in range(1, len(X) + 1):
        pow1[i] = (pow1[i - 1] * 2) % MOD1

X1 = 0
X2 = 0
for i in range(N):
    if X[i] == '1':
        X1 += pow1[N - i - 1]
        X2 += pow2[N - i - 1]
X1 %= MOD1
if MOD2 != 0:
    X2 %= MOD2

for i in range(N):
    d = N - i - 1
    if X[i] == '0':
        x = (X1 + pow1[d]) % MOD1
        print(f(x) + 1)
    else:
        if MOD2 != 0:
            x = (X2 - pow2[d]) % MOD2
            print(f(x) + 1)
        else:
            print(0)
f = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
n, m = map(int, input().split())
a = list(map(int, input().split()))

memo = [-1]*100100

def dp(i):
    # i本のマッチを使って作れる最大の整数
    if i < 0:
        return - 10 ** 100000
    if memo[i] != -1:
        return memo[i]
    if i == 0:
        return 0
    ret = -10**100000
    for x in a:
        ret = max(ret, 10 * dp(i - f[x]) + x)
    memo[i] = ret
    return ret


print(dp(n))


### FIXED CODE ###

import resource
import sys
sys.setrecursionlimit(20000)
f = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
n, m = map(int, input().split())
a = list(map(int, input().split()))

memo = ["-1"] * 10100


def MAX(x, y):
    if y[0] != '#' and (x == "#" or len(x) < len(y) or (len(x) == len(y) and x < y)):
        return y
    else:
        return x


def dp(i):
    # i本のマッチを使って作れる最大の整数
    if i < 0:
        return "#"

    if memo[i] != "-1":
        return memo[i]

    if i == 0:
        return ""

    ret = "#"
    for x in a:
        ret = MAX(ret, dp(i - f[x]) + str(x))
    memo[i] = ret
    return ret


print(dp(n))
N = int(input())
reds = sorted([list(map(int,input().split())) for i in range(n)])
blues = sorted([list(map(int,input().split()))])

reds = reds[::-1]
res = 0

for c,d in blues:
  for a,b in reds:
    if a<c and b<d:
      reds.remove([a,b])
      res+=1
      break
      
print(res)


### FIXED CODE ###

n = int(input())
reds = sorted([list(map(int,input().split())) for i in range(n)],key=lambda reds: -reds[1])
blues = sorted([list(map(int,input().split())) for i in range(n)])

res = 0

for c,d in blues:
  for a,b in reds:
    if a<c and b<d:
      reds.remove([a,b])
      res+=1
      break
      
print(res)
n = int(input())
list = list(map(int, input().split()))

if "Y" in list:
    print("Four")
else:
    print("Three")

### FIXED CODE ###

n = int(input())
list = list(map(str, input().split()))

if "Y" in list:
    print("Four")
else:
    print("Three")
#include<bits/stdc++.h>
using namespace std;
int dp[10000001];
int arr[10000001];
int n;
int solve(int ind)
{
	if(ind==n-1)
	{
		return 0;
	}
	if(dp[ind]!=-1)
	{
		return dp[ind];
	}
	int ans=solve(ind+1)+abs(arr[ind+1]-arr[ind]);
	if(ind+2<n)
	{
		ans=min(ans,solve(ind+2)+abs(arr[ind+2]-arr[ind]));
	}
	return dp[ind]=ans;
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	memset(dp,-1,sizeof(dp));
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	cout<<solve(0)<<"\n";
	return 0;
}

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
dp=[10**55 for i in range(n)]
dp[0]=0
dp[1]=abs(l[1]-l[0])
for i in range(2,n):
    dp[i] = min(dp[i], dp[i-1] + abs(l[i] - l[i - 1]))
    dp[i] = min(dp[i], dp[i-2] + abs(l[i] - l[i - 2]))
print(dp[n-1])
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    a = [(abs(int(i)),int(i)) for i in ipt().split()]
    a.sort()
    if a[2][1] > 0:
        op = [(a[0][1],a[1][1])]
        ans = a[0][1]-a[1][1]
    else:
        ans = a[1][1]-a[0][1]
        op = [(a[1][1],a[0][1])]
    for i,ai in enumerate(a[2:n-1:]):
        if a[i+3][1] > 0:
            op.append((min(ans,ai[1]),max(ans,ai[1])))
            ans = min(ans,ai[1])-max(ans,ai[1])
        else:
            op.append((max(ans,ai[1]),min(ans,ai[1])))
            ans = max(ans,ai[1])-min(ans,ai[1])
    op.append((max(ans,a[n-1][1]),min(ans,a[n-1][1])))
    ans = max(ans,a[n-1][1])-min(ans,a[n-1][1])
    print(ans)
    for x,y in op:
        print(x,y)
    return

if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    a = [int(i) for i in ipt().split()]
    a.sort()

    if n == 2:
        print(a[1]-a[0])
        print(a[1],a[0])
    else:
        if a[1] > 0:
            ans = a[0]-a[-1]
            op = [(a[0],a[-1])]
        else:
            ans = a[-1]-a[0]
            op = [(a[-1],a[0])]
        f = True
        for i in range(1,n-2):
            if f and a[i+1] > 0:
                f = False
            if f:
                op.append((max(ans,a[i]),min(ans,a[i])))
                ans = max(ans,a[i])-min(ans,a[i])
            else:
                op.append((min(ans,a[i]),max(ans,a[i])))
                ans = min(ans,a[i])-max(ans,a[i])
        op.append((max(ans,a[n-2]),min(ans,a[n-2])))
        ans = max(ans,a[n-2])-min(ans,a[n-2])
        print(ans)
        for x,y in op:
            print(x,y)


if __name__ == '__main__':
    main()
s=input()
q=int(input())
a=[list(map(str,input().split())) for i in range(q)]

ans=[]
ans.append(s)

for i in range(q):
  if len(a[i])==1:
    ans.insert(0,ans[-1])
    ans.append(ans[1])
    print(ans)
    ans.pop(1)
    ans.pop(-2)

  else:
    if a[i][1]=='1':
      ans.insert(0,a[i][2])
    else:
      ans.append(a[i][2])

print(''.join(ans))

### FIXED CODE ###

from collections import deque

s=deque(input())
q=int(input())
qq=[list(input().split()) for i in range(q)]

rl=1
fleft=deque()
fright=deque()

for i in qq:
  if i[0]=='1':
    rl*=-1
  else:
    if i[1]=='1':
      if rl==1:
        fleft.appendleft(i[2])
      else:
        fright.append(i[2])
    else:
      if rl==1:
        fright.append(i[2])
      else:
        fleft.appendleft(i[2])

fleft.reverse()

s.extendleft(fleft)
s.extend(fright)

if rl==-1:
  s.reverse()

print(''.join(s))
n = int(input())
list_p = list(map(int, input().split()))
same_p = [1 if i+1 == p else 0 for i, p in enumerate(list_p)]

count = 0
i = 0
while i < n:
  if sum(same_p) == 0:
    break
  if same_p[i] == 1:
    temp_p = list_p[i]
    list_p[i] = list_p[i+1]
    list_p[i+1] = temp_p
    same_p[i] = 0
    same_p[i+1] = 0
    if list_p[i+1] == i+2:
      same_p[i+1] = 1
    count += 1
  i += 1
print(count)

### FIXED CODE ###

n = int(input())
list_p = list(map(int, input().split()))
count = 0
i = 0
while i < n:
  if list_p[i] == i + 1:
    count += 1
    i += 2
  else:
    i += 1
    continue
print(count)
def available(start, end, S, step=None):
    if step is not None:    #   追い越し処理
        S = S[:step] + "#" + S[step+1:]
    for i in range(start-1, end-1):
        if S[i] == "#" and S[i+1] == "#":
            return False
    return True, S
    
def overtake(start, end, S):
    fixed_end = min(end-1, len(S)-2)
    fixed_start = max(start-1, 1)
    for i in range(fixed_start, fixed_end):
        if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
            step = i
            return True, step
    return False, None

N, A, B, C, D = map(int, input().split())
S = input()

if D > C:   #   追い越しが不要な時
    judge1, S = available(A, C, S)
    judge2, S = available(B, D, S)
    if judge1 and judge2:
        print("Yes")
    else:
        print("No")
else:   #   追い越しが必要な時
    overtakable, step = overtake(B, D, S)
    if overtakable:   #   追い越しが可能な時
        judge1, S = available(B, D, S)
        judge2, S = available(A, C, S, step=step)
        if judge1 and judge2:
            print("Yes")
        else:
            print("No")
    else:   #   追い越しができない時
        print("No")
        

### FIXED CODE ###

def available(start, end, S, step=None):
    if step is not None:    #   追い越し処理
        S = S[:step] + "#" + S[step+1:]
    for i in range(start, end):
        if S[i] == "#" and S[i+1] == "#":
            return False, S
    return True, S
    
def overtake(start, end, S):
    for i in range(start, end+1):
        if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
            step = i
            return True, step
    return False, None

N, A, B, C, D = map(int, input().split())
S = "." + input() + "."

if D > C:   #   追い越しが不要な時
    judge1, S = available(A, C, S)
    judge2, S = available(B, D, S)
    if judge1 and judge2:
        print("Yes")
    else:
        print("No")
else:   #   追い越しが必要な時
    overtakable, step = overtake(B, D, S)
    if overtakable:   #   追い越しが可能な時
        judge1, S = available(B, D, S)
        judge2, S = available(A, C, S, step=step)
        if judge1 and judge2:
            print("Yes")
        else:
            print("No")
    else:   #   追い越しができない時
        print("No")
a, b, c, k = map(int, input().split());

if a > k:
  print(k)
  break;
else:
  num = a; 
  
  if k >= a + b:
  num -= k - (a + b);

print(num)
  
  


### FIXED CODE ###

a, b, c, k = map(int, input().split());

if a > k:
  print(k)
else:
  num = a; 
  
  if k >= a + b:
      num -= k - (a + b);
  print(num)
import numpy as np
import sys
sys.setrecursionlimit(2000)
H,N = map(int, input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

memo = [10**4+1 for i in range(H+1)]

def memorize(H,memo,A,B,N):
    if H<= 0:
        return 0
    else:
        if memo[H]!=10**4+1:
            return memo[H]
        cost_min = 10**4+1
        for i in range(N):
            cost = B[i] + memorize(H-A[i],memo,A,B,N)
            cost_min = min(cost_min,cost)
        memo[H] = cost_min
        return cost_min
        
print(memorize(H,memo,A,B,N))

### FIXED CODE ###

import numpy as np
 
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab = np.array(ab)
 
a = ab[:, 0]
b = ab[:, 1]
 
dp = np.zeros(100001, dtype=np.int)
for i in range(1, h+1):
    dp[i] = (dp[i-a]+b).min()

print(dp[h])
h,w=map(int,input().split())
if h==1 or w==1:
    print(1)
    exit()
if h%2+w%2==0:
    print((h//2)*w)
elif h%2==1 and w%2==0:
    print((w//2)*h)
elif w%2==1 and h%2==0:
    print((h//2)*w)
else:
    print((h//2+1)*(w-w//2)+(h//2)*(w//2))


### FIXED CODE ###

k=int(input())
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])
S = input()
T = input()

count = 0
for i in range(1000):
    if S[i] == T[i]:
        cnt += 1
print(count)

### FIXED CODE ###

S = input()
T = input()

count = 0
for i in range(3):
    if S[i] == T[i]:
        count =count + 1
print(count)
a,b=input()
a=int(a)
b=int(b)
c=a*b
amari=c%2
if amari=0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a, b=map(int, input().split())
c=(a*b)%2
if c==0:
  print("Even")
else:
  print("Odd")
N, A, B, K = map(int, input().split())

mod = 998244353
F = [1]
RF = []


def inv(x):
    res = 1
    k = mod - 2
    y = x
    while k:
        if k & 1:
            res = (res * y) % mod
        y = (y * y) % mod
        k //= 2
    return res


def init():
    for i in range(N):
        F.append((F[i] * (i + 1)) % mod)
    for i in F:
        RF.append(inv(i))


def comb(x, y):
    return (F[x] * ((RF[x - y] * RF[y]) % mod)) % mod


ans = 0
init()
for a in range(N):
    b = (K - a * A) / B
    if b < 0:
        break
    if b.is_integer():
        ans += (comb(N, a) * (comb(N, int(b)))) % mod
print(ans % mod)


### FIXED CODE ###

N, A, B, K = map(int, input().split())

mod = 998244353
fact = [1] * (N + 1)
ifact = [1] * (N + 1)


def init():
    for i in range(N):
        fact[i + 1] = fact[i] * (i + 1) % mod
        ifact[i + 1] = pow(fact[i + 1], mod - 2, mod)


def comb(x, y):
    if y < 0 or y > x:
        return 0
    return (fact[x] * ifact[x - y] * ifact[y]) % mod


ans = 0
init()
for a in range(N + 1):
    n = K - a * A
    if n < 0:
        break
    if n % B == 0:
        ans += (comb(N, a) * (comb(N, n // B))) % mod
print(ans % mod)
a, b, c = map(int, input().split())
ans = "No"
if a < b < c:
    ans = "Yes"
print (ans)



### FIXED CODE ###

a, b, c = map(int, input().split())
ans = "No"
if a < b < c:
    ans = "Yes"
print (ans)
s = input()

mod = [0] * 2019
mod[0] = 1
d = 1
n = 0
ans = 0

for i in reversed(s):
    n += int(i) * d
    n %= 2019
    d *= 10
    d %= 2019
    mod[n % 2019] += 1

for i in mod:
    ans += sum(i*(i-1) // 2)

print(ans)


### FIXED CODE ###

s = input()

mod = [0] * 2019
mod[0] = 1
d = 1
n = 0
ans = 0

for i in reversed(s):
    n += int(i) * d
    n %= 2019
    d *= 10
    d %= 2019
    mod[n % 2019] += 1

for x in range(2019):
    ans += mod[x] * (mod[x]-1) // 2

print(ans)
n, m = map(int,input().split())

aclist = []
ac = 0
wac = 0
count = [0 for x in range(n+1)]

for i in range(m):
  a , b = input().split()
  int(a)
  if n >= 0:
    if n == "AC":
      ac += 1
      wac += count[a]
      count[a] = -1
    else:
      count[a] += 1

print(ac, wac)

### FIXED CODE ###

n, m = map(int,input().split())

ac = 0
wac = 0
count = [0 for x in range(n+1)]

for i in range(m):
  a , b = input().split()
  c = int(a)
  if count[c] >= 0:
    if b == "AC":
      ac += 1
      wac += count[c]
      count[c] = -1
    else:
      count[c] += 1

print(ac, wac)