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

import sys
input = lambda: sys.stdin.readline().rstrip()

mod = 10**9 + 7


def solve():

    S = ['0'] + list(reversed(input()))
    N = len(S) - 1
    dp = [[-1 for _ in range(13)] for _ in range(N + 1)]
    dp[0][0] = 1

    for i in range(1, N + 1):
        if S[i] == '?':
            for j in range(13):
                if dp[i - 1][j] != -1:
                    for k in range(10):
                        n = k * (10 ** (i - 1))
                        r = n % 13
                        jj = (j + r) % 13
                        if dp[i][jj] == -1:
                            dp[i][jj] = dp[i - 1][j]
                        else:
                            dp[i][jj] = (dp[i][jj] + dp[i - 1][j]) % mod

        else:
            for j in range(13):
                if dp[i - 1][j] != -1:
                    n = int(S[i]) * (10 ** (i - 1))
                    r = n % 13
                    jj = (j + r) % 13
                    dp[i][jj] = dp[i - 1][j]

    ans = dp[N][5] if dp[N][5] != -1 else 0
    print(ans)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

mod = 10 ** 9 + 7

S = input()
dp = [[0] * 13 for _ in range(len(S) + 1)]
dp[0][0] = 1
mul = 1

for i in range(len(S)):
    x = S[-(i + 1)]
    if x == "?":
        for k in range(10):
            for j in range(13):
                dp[i + 1][(mul * k + j) % 13] += dp[i][j]
                dp[i + 1][(mul * k + j) % 13] %= mod
    else:
        k = int(x)
        for j in range(13):
            dp[i + 1][(mul * k + j) % 13] += dp[i][j]
            dp[i + 1][(mul * k + j) % 13] %= mod
    mul = mul * 10 % 13

print(dp[len(S)][5])
### BUGGY CODE ###

import bisect

def main():
    n, m = map(int, input().split())
    py = [list(map(int, input().split())) for _ in range(m)]
    x = [[0] for _ in range(n+1)]
    for p, y in py:
        bisect.insort_left(x[p], y)
    for p, y in py:
        num = x[p].index(y)
        print('{:0=6}{:0=6}'.format(p, num))
         
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    py = [list(map(int, input().split())) for _ in range(m)]
    x = sorted(py, key=lambda x:x[1])
    d = {}
    for p, y in x:
        if type(d.get(p)) != dict:
            d[p]  = {}
        d[p][y] = len(d[p]) + 1
    for p, y in py:
        print('{:0=6}{:0=6}'.format(p, d[p][y]))
         
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

from collections import defaultdict
n, m = map(int, input().split())
li = []
dic = defaultdict(list)
for i in range(m):
    p, y = map(int, input().split())
    li.append([p, y])
    dic[p].append(y)
for d in dic:
    dic[d].sort()
for p, y in li:
    ans1 = str(p).zfill(6)
    ans2 = str(dic[p].index(y) + 1).zfill(6)
    print(ans1+ans2)


### FIXED CODE ###

n, m = map(int, input().split())
cnt = [[] for _ in range(n)]
for i in range(m):
    p, y = map(int, input().split())
    cnt[p-1].append((y, i))
ans = [None]*m
for p, li in enumerate(cnt):
    if not li:
        continue
    li.sort()
    for j, (y, i) in enumerate(li):
        ans[i] = '{:06d}{:06d}'.format(p+1, j+1)
print('\n'.join(ans))
### BUGGY CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[46]:


N,Q=map(int,input().split())
S=input()
lr=[list(map(int,input().split())) for l in range(Q)]

for i in range(Q):
    t=S[lr[i][0]-1:lr[i][1]]
    #t=[S for j in range(lr[i][0],lr[i][1])]
    #print(t)
    print(t.count('AC'))
    if i==Q:
        break


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[4]:


N,Q=map(int,input().split())
S=input()
lr=[list(map(int,input().split())) for l in range(Q)]
ct=0
l=[0]*(N+1)
for i in range(0,len(S)-1):
    if S[i]=='A' and S[i+1]=='C':
        l[i+1]=1+l[i]
    else:
        l[i+1]=l[i]
for i in range(Q):
    print(l[lr[i][1]-1]-l[lr[i][0]-1])


# In[ ]:
### BUGGY CODE ###

import sys

input = sys.stdin.readline

P = 10 ** 9 + 7
Q = 13


def main():
    S = input().rstrip()

    N = len(S)
    dp = [[0] * Q for _ in range(N + 1)]
    dp[0][0] = 1
    for i in range(N):
        D = S[i]
        if D == "?":
            for d in range(10):
                for j in range(Q):
                    dp[i + 1][(10 * j + d) % Q] += dp[i][j]
        else:
            d = int(D)
            for j in range(Q):
                dp[i + 1][(10 * j + d) % Q] += dp[i][j]

        for j in range(Q):
            dp[i + 1][j] %= P

    ans = dp[N][5]
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

input = sys.stdin.readline

P = 10 ** 9 + 7
Q = 13


def main():
    S = input().rstrip()

    N = len(S)
    dp = [[0] * Q for _ in range(N + 1)]
    dp[0][0] = 1
    for i in range(N):
        base = pow(10, N - 1 - i, Q)
        D = S[i]
        if D == "?":
            for d in range(10):
                n = d * base
                for j in range(Q):
                    next_j = (j + n) % Q
                    dp[i + 1][next_j] += dp[i][j]
                    dp[i + 1][next_j] %= P
        else:
            n = int(D) * base
            for j in range(Q):
                next_j = (j + n) % Q
                dp[i + 1][(j + n) % Q] += dp[i][j]
                dp[i + 1][(j + n) % Q] %= P

    ans = dp[N][5]
    print(ans)


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

#coding utf-8
_=input()
bars=[i for i in map(int,input().split())]
bars.sort(reverse=True)
stock=[]
ret=0
_old=-1
for bar in bars:
    if bar==_old:
        continue
    _old=bar
    count=bars.count(bar)
    if count>=4:
        if len(stock)!=0 and  bar not in stock:
            #print("ret bar bar")
            ret=bar*stock[0]
        else:
            #print("ret bar bar")
            ret=bar*bar
        break
    elif count>=2:
        if bar in stock:
            continue
        stock.append(bar)
        if len(stock)==2 :
            #print("ret stock stock")
            ret=stock[0]*stock[1]
            break
print(ret)

### FIXED CODE ###

#coding utf-8
import collections
_=input()
bars=[i for i in map(int,input().split())]
data=sorted(collections.Counter(bars).items(),key= lambda x: -x[0] )
stock=0
ret=0
for bar ,count in data:
    if count>=4:
        if stock:
            ret=stock*bar
            break
        else:
            ret=bar*bar
            break
    elif count>=2:
        if stock:
            ret=stock*bar
            break
        else:
            stock=bar
print(ret)
### BUGGY CODE ###

s = input()
k = int(input())
a = []

for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        a.append(s[i:j])

res = sorted(set(a))
print(res[k-1])

### FIXED CODE ###

s = input()
k = int(input())
a = []

for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        if j - i >= 6:
            break
        a.append(s[i:j])

res = sorted(set(a))
print(res[k-1])
### BUGGY CODE ###

n,*s=open(0)
n=int(n)
s=[tuple(t.rstrip())for t in s]
c=0
for _ in range(n):
  if all(x==y for x,y in zip(s,zip(*s))):c+=n
  s=s[1:]+s[:1]
print(c)

### FIXED CODE ###

n,*s=[t[:-1]for t in open(0)]
n=int(n)
c=0
for _ in range(n):
  c+=all(x==''.join(y)for x,y in zip(s,zip(*s)))*n
  s=s[1:]+s[:1]
print(c)
### BUGGY CODE ###

# 2020/04/22
# AtCoder Beginner Contest 142 - C

# Input
n = int(input())
a = list(map(int,input().split()))
tbl = [-1] * (n+1)

# Calc
for i in range(n):
    tbl[a[i]] = i+1

# Output
ans = str(tbl[1])
for i in range(2, n+1):
    ans = ans + " " + str(tbl[i])

print(ans)

### FIXED CODE ###

# 2020/04/22
# AtCoder Beginner Contest 142 - C

# Input
n = int(input())
a = list(map(int,input().split()))
tbl = [-1] * (n+1)

# Calc
for i in range(n):
    tbl[a[i]] = i+1

tbl.pop(0)

# Output
print(' '.join(map(str, tbl)))
### BUGGY CODE ###

import heapq

N, M = [int(s) for s in input().split()]
A = [int(s) for s in input().split()]

hpq = list(map(lambda x: -1 * x, A))
for i in range(M):
    heapq.heapify(hpq)
    x = heapq.heappop(hpq)
    heapq.heappush(hpq, x / 2)

print(sum(map(lambda x: int(-1 * x), hpq)))

### FIXED CODE ###

import heapq
 
N, M = [int(s) for s in input().split()]
A = [int(s) for s in input().split()]
 
hpq = list(map(lambda x: -1 * x, A))
heapq.heapify(hpq)
for i in range(M):
    x = heapq.heappop(hpq)
    heapq.heappush(hpq, x / 2)

print(sum(map(lambda x: int(-1 * x), hpq)))
### BUGGY CODE ###

import itertools
L, R = map(int, input().split())
num_list = [i for i in range(L, R + 1)]
l = list(itertools.combinations(num_list, 2))

ans_list = [0 for _ in range(len(l))]
for i in range(len(ans_list)):
    ans_list[i] = (l[i][0] * l[i][1]) % 2019
print(min(ans_list))

### FIXED CODE ###

ans = 2020
L, R = map(int, input().split())
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        mod = i * j % 2019
        if mod == 0:
            print(0)
            exit(0)
        ans = min(ans, mod)
print(ans)
### BUGGY CODE ###

n = int(input())
lst = list(input())
cnt = 0
Num = []
for i in range(10):
    for j in range(10):
        for k in range(10):
            s = [str(i),str(j),str(k)]
            Num.append(s)

for num in Num:
    flag1 = False
    flag2 = False
    memo1 = 0
    memo2 = 0
    for x in range(n-2):
        if num[0] == lst[x]:
            flag1 = True
            memo1 = x
            break
    if flag1:
        for y in range(memo1+1,n-1):
            if num[1] == lst[y]:
                flag2 = True
                memo2 = y
                break
        if flag2:
            for z in range(memo2+1,n):
                if num[2] == lst[z]:
                    cnt += 1
                    break
print(cnt)

### FIXED CODE ###

n = int(input())
lst = list(input())
cnt = 0
Num = []
for i in range(10):
    for j in range(10):
        for k in range(10):
            s = [str(i),str(j),str(k)]
            Num.append(s)

for num in Num:
    flag1 = False
    flag2 = False
    memo1 = 0
    memo2 = 0
    for x in range(n-2):
        if num[0] == lst[x]:
            flag1 = True
            memo1 = x
            break
    if flag1:
        for y in range(memo1+1,n-1):
            if num[1] == lst[y]:
                flag2 = True
                memo2 = y
                break
        if flag2:
            for z in range(memo2+1,n):
                if num[2] == lst[z]:
                    cnt += 1
                    break
print(cnt)
### BUGGY CODE ###

s = input()
q = int(input())
is_r = False
f_list = []
b_list = []

for i in range(q):
    q_i = input().split(' ')
    t_i = q_i[0]
    if t_i == '1':
        is_r = not is_r
    else:
        f_i = q_i[1]
        if (f_i == '1' and not is_r) or (f_i == '2' and is_r):
            f_list.insert(0, q_i[2])
        else:
            b_list.append(q_i[2])

f_list.append(s)
f_list.extend(b_list)
s = ''.join(f_list) if not is_r else ''.join(f_list)[::-1]
print(s)

### FIXED CODE ###

s = input()
q = int(input())
is_r = False
f_list = []
b_list = []

for i in range(q):
    q_i = input().split(' ')
    t_i = q_i[0]
    if t_i == '1':
        is_r = not is_r
    else:
        f_i = q_i[1]
        if (f_i == '1' and not is_r) or (f_i == '2' and is_r):
            f_list.append(q_i[2])
        else:
            b_list.append(q_i[2])

f_list = f_list[::-1]
f_list.append(s)
f_list.extend(b_list)
s = ''.join(f_list) if not is_r else ''.join(f_list)[::-1]
print(s)
### BUGGY CODE ###

def make_divisors(n):
    cnt = 0
    i = 1
    while i*i <= n:
        if n % i == 0:
            cnt += 1
            if i != n // i:
                cnt += 1
        i += 1
    return cnt
numbers = [1,10, 100, 1000, 10000, 100000, 150000,200000, 250000,300000,350000, 400000,450000, 500000,550000,600000,630000,675000,750000,800000,825000,850000,875000,900000,925000,950000,975000,987500,1000000]
datas = [0,23,473,7053,93643,1166714, 1810893, 2472071, 3145923, 3829761, 4522005,5221424,5927120,6638407,7354651,8075420,8509899,9164377,10261678,10997400,11366472,11736253,12106789,12478098,12850013,13222660,13595947,13782871,13969985]

N = int(input())
ttl = 0
numPin = 0

for i in range(len(numbers)):
    if N == 1000000:
        numPin = len(numbers) - 1
        break
    if numbers[i] <= N < numbers[i+1]:
        numPin = i
        break

if numPin != len(numbers)-1:
    if N - numbers[numPin] < numbers[numPin + 1] - N:
        for i in range(numbers[numPin], N):
            ttl += make_divisors(i)
        print(ttl + datas[numPin])
    else:
        for i in range(N,numbers[numPin+1]):
            ttl -= make_divisors(i)
        print(ttl + datas[numPin + 1])
else:
    print(datas[numPin])


### FIXED CODE ###

def make_divisors(n):
    cnt = 0
    i = 1
    while i*i <= n:
        if n % i == 0:
            cnt += 1
            if i != n // i:
                cnt += 1
        i += 1
    return cnt
numbers = [1,10, 100, 1000, 10000, 100000, 150000,200000, 250000,300000,350000, 400000,450000, 500000,550000,600000,630000,675000,700000,720000,750000,800000,825000,850000,875000,900000,912500,925000,950000,975000,987500,1000000]
datas = [0,23,473,7053,93643,1166714, 1810893, 2472071, 3145923, 3829761, 4522005,5221424,5927120,6638407,7354651,8075420,8509899,9164377,9529244,9821778,10261678,10997400,11366472,11736253,12106789,12478098,12664043,12850013,13222660,13595947,13782871,13969985]

N = int(input())
ttl = 0
numPin = 0

for i in range(len(numbers)):
    if N == 1000000:
        numPin = len(numbers) - 1
        break
    if numbers[i] <= N < numbers[i+1]:
        numPin = i
        break

if numPin != len(numbers)-1:
    if N - numbers[numPin] < numbers[numPin + 1] - N:
        for i in range(numbers[numPin], N):
            ttl += make_divisors(i)
        print(ttl + datas[numPin])
    else:
        for i in range(N,numbers[numPin+1]):
            ttl -= make_divisors(i)
        print(ttl + datas[numPin + 1])
else:
    print(datas[numPin])
### BUGGY CODE ###

N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0
for i in range(N):
    for j in range(i+1,N):
        a = L[i]
        b = L[j]
        for k in range(j+1,N):
            c = L[k]
            if (c < a + b):
                ans += 1
            else:
                break
print(ans)


### FIXED CODE ###

from bisect import bisect_left

N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0
for i in range(N):
    for j in range(i+1,N):
        a = L[i]
        b = L[j]
        ans += bisect_left(L[j+1:], a+b)
print(ans)
### BUGGY CODE ###

import bisect

n, d, a = map(int, input().split())
xh = []
x_list = []
for i in range(n):
    x, h = map(int, input().split())
    xh.append([x, h])
    x_list.append(x)
xh.sort()
x_list.sort()
count = 0
min_x = 0
sum_h = sum([xh[i][1] for i in range(n)])
while sum_h > 0:
    flag = True
    place = xh[min_x][0] + d
    num = (xh[min_x][1] - 1) // a + 1
    count += num
    for i in range(min_x, bisect.bisect(x_list, place + d)):
        new_h = max(0, xh[i][1] - a * num)
        sum_h -= (xh[i][1] - new_h)
        if new_h == 0:
            if flag == True:
                min_x += 1
        else:
            flag = False
        xh[i][1] = new_h
print(count)

### FIXED CODE ###

import bisect

n, d, a = map(int, input().split())
xh = []
for i in range(n):
    xh.append(list(map(int, input().split())))
xh.sort()
x = [xh[i][0] for i in range(n)]
h = [xh[i][1] for i in range(n)]
count = 0
min_x = 0
acm = [0] * (n + 1)
dif = [0] * (n + 1)
while min_x < n:
    place = x[min_x] + d
    num = (h[min_x] - acm[min_x + 1] - 1) // a + 1
    count += num
    dif[min_x] += num
    dif[bisect.bisect(x, place + d)] -= num
    for i in range(min_x, bisect.bisect(x, place + d)):
        acm[i + 1] = acm[i] + dif[i] * a
        if acm[i + 1] >= h[i]:
            min_x += 1
            continue
        else:
            break
print(count)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W = map(int, input().split())
    grid = list(list(input()) for _ in range(H))

    res = 0
    while True:
        NEXT = set()
        cnt = 0
        for h in range(H):
            for w in range(W):
                if grid[h][w] == "#":
                    cnt += 1
                    for dh, dw in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
                        next_h, next_w = h + dh, w + dw
                        if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:
                            continue
                        if grid[next_h][next_w] == ".":
                            NEXT.add((next_h, next_w))
        if cnt == H * W:
            break

        for next_h, next_w in NEXT:
            grid[next_h][next_w] = "#"
        res += 1
    print(res)


if __name__ == '__main__':
    resolve()


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
grid = [input() for i in range(H)]

cnt = [[-1]*W for _ in range(H)]

que = deque()
for h in range(H):
    for w in range(W):
        if grid[h][w] == '#':
            que.append((h, w))
            cnt[h][w] = 0

ans = 0
while que:
    h, w = que.popleft()
    ans = cnt[h][w]
    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        next_h = h + dy
        next_w = w + dx
        if next_h < 0 or H <= next_h or next_w < 0 or W <= next_w:
            continue
        if cnt[next_h][next_w] == -1:
            cnt[next_h][next_w] = ans+1
            que.append((next_h, next_w))

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

import sys
sys.setrecursionlimit(10**9)

def addc(p,b):
  for i in e[p]:
    if(i == b):
      continue
    c[i] += c[p]
    addc(i,p)

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

e = [ [] for i in range(n + 1)]
c = [0]*(n+1)

for i in range(n-1):
  a,b = map(int,input().split())
  e[a].append(b)
  e[b].append(a)

for i in range(q):
  p,x = map(int,input().split())
  c[p] += x

addc(1,-1)

c.pop(0)

print(*c)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

def addc(p,b):
  for i in e[p]:
    if(i == b):
      continue
    c[i] += c[p]
    addc(i,p)

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

e = [ [] for i in range(n + 1)]
c = [0]*(n+1)

for i in range(n-1):
  a,b = map(int,input().split())
  e[a].append(b)
  e[b].append(a)

for i in range(q):
  p,x = map(int,input().split())
  c[p] += x

addc(1,-1)

print(*c[1:])
### BUGGY CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
Ad = [0] *N

for i in range(N):
    Ad[i] = A[i]
    dA = [x-y for (x,y) in zip(A,Ad)]
    print(max(dA))
    Ad[i] =0

### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
A_reverse = sorted(A)

for i in range(N):
    if A[i] == A_reverse[-1]:
        print(A_reverse[-2])
    else:
        print(A_reverse[-1])
### BUGGY CODE ###

from fractions import gcd
n = int(input())
ans = 0
for i in range (1, n+1):
  for j in range (1, n+1):
    gcd1 = gcd(i,j)
    
    for k in range (1, n+1):
      
      gcdf  = gcd(gcd1,k)
      ans = ans+gcdf
print(ans)

### FIXED CODE ###

from math import gcd
N = int(input())
ans = 0
for i in range(1,N+1):
  for j in range(1,N+1):
    for k in range(1,N+1):
      ans += gcd(gcd(i,j),k)
print(ans)
### BUGGY CODE ###

s = input()
s = s[::-1]
lis = ['remaerd', 'resare', 'esare', 'maerd']
i = 0
j = 0
#s = s[::-1]
while i < len(s):
    while True:
        tmp = s[i : j]
        #print(s[i : j])
        if len(tmp) == 8:
            print('NO')
            #quit()
        elif tmp in lis:
            i = j
            j = i + 5
            break
        else:
            j += 1
print('YES')

### FIXED CODE ###

s = input()
s = s[::-1]
lis = ['remaerd', 'resare', 'esare', 'maerd']
i = 0
j = 0
#s = s[::-1]
while i < len(s):
    tmp = ''
    while j < len(s):
        tmp += s[j]
        #print(tmp)
        if len(tmp) == 8:
            print('NO')
            quit()
        elif tmp in lis:
            i = j + 1
            j = i
            break
        else:
            j += 1
print('YES')
### BUGGY CODE ###

def main():
    import heapq
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    h = [(-j,i) for i,j in enumerate(b)]
    h2 = []
    heapq.heapify(h)
    cnt = 0
    while h:
        i, j = heapq.heappop(h)
        i=-i
        sho=(i-a[j])//(b[j-1]+b[(j+1)%n])
        if  sho==0:
            h2.append((i, j))
            continue
        cnt += sho
        b[j] -= (b[j-1]+b[(j+1)%n])*sho
        heapq.heappush(h, (-b[j], j))
    h2.sort(key=lambda x: x[1])
    if all([a[i] == h2[i][0] for i in range(n)]):
        print(cnt)
    else:
        print(-1)


main()

### FIXED CODE ###

def main():
    from heapq import heappop as hpop
    from heapq import heappush as hpush
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    h = []
    for i in range(n):
        hpush(h, (-b[i], i))
    cnt = 0
    while h:
        i, j = hpop(h)
        i = -i
        jj = (j+1) % n
        temp = i-a[j]
        temp2 = b[j-1]+b[jj]
        sho = temp//temp2
        if sho == 0:
            if temp:
                print(-1)
                return 0
            continue
        cnt += sho
        b[j] -= temp2*sho
        hpush(h, (-b[j], j))
    print(cnt)
main()
### BUGGY CODE ###

def solve():
    for i in range(n):
        if a[i]!=a_max:
            print(a_max)
        else:
            a[i]=0
            print(max(a))
            a[i]=a_max

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

### FIXED CODE ###

n=int(input())
a=[int(input()) for i in range(n)]
a_max=max(a)
a_sort=sorted(a,reverse=True)
for i in range(n):
    if a[i]!=a_max:
        print(a_max)
    else:
        print(a_sort[1])
### BUGGY CODE ###

r, g, b, n = map(int, input().split())
cnt = 0
for i in range(n+1):
    for j in range(n+1):
        v = r*i + g*j
        if n>=v and (n-v)%b==0: cnt+=1
print(cnt)


### FIXED CODE ###

r, g, b, n = map(int, input().split())
cnt = 0
for i in range(n+1):
    for j in range(n+1):
        v = r*i + g*j
        if n>=v and (n-v)%b==0: cnt+=1
print(cnt)
### BUGGY CODE ###

N,K=map(int,input().split())
p=list(map(int,input().split()))

maxi=-1
sum=0

for i in range(0,N-K+1):
  sum=0
  for j in range(i,i+K):
    sum += (p[j]+1)/2
    maxi=max(maxi,sum)
  
print(maxi)

### FIXED CODE ###

N,K=map(int,input().split())
p=list(map(int,input().split()))

sum=[0]*N
sum_f=0

for j in range(K):
  sum_f += (p[j]+1)/2
sum[0]=sum_f
  
for i in range(1,N-K+1):
  sum[i]=sum[i-1] - (p[i-1]+1)/2 + (p[i+K-1]+1)/2
  
print(max(sum))
### BUGGY CODE ###

N,A,B = map(int,input().split())
h = [0]*N
for i in range(N):
    h[i] = int(input())

# x回で全モンスター倒せるかどうかをにぶちゃん(にぱー)

import math

def check(x):
    count = 0
    for i in range(N):
        count += math.ceil(max(h[i] - B * x, 0) / (A - B))
           
    if count <= x:
        return True
    else:
        return False
    
left = -1
right = 10**9+1

while abs(right-left) > 1:
    center = (right+left)//2
    
    if check(center) == True:
        right = center
    elif check(center) == False:
        left = center
        
print(right)

### FIXED CODE ###

N,A,B = map(int,input().split())
h = [0]*N
for i in range(N):
    h[i] = int(input())

# x回で全モンスター倒せるかどうかをにぶちゃん(にぱー)

import math

def check(x):
    count = 0
    for i in range(N):
        count += math.ceil(max(h[i] - B * x, 0) / (A - B))
           
    if count <= x:
        return True
    else:
        return False
    
def solve():
    
    left = -1
    right = 10**9+1
    
    while abs(right-left) > 1:
    
        center = (right+left)//2
    
        if check(center) == True:
            right = center
        elif check(center) == False:
            left = center
        
    return right
    
print(solve())