Harryxun/stf_run huggingface dataset:
n = int(input())
*l, = map(int,input().split())
ans = 1
for i in l:
  ans *= i
  if ans > 10**18:
    ans = -1
    break
if 0 in ;:
  ans = 0
print(ans)


### FIXED CODE ###

n = int(input())
*l, = map(int,input().split())
ans = 1
for i in l:
  ans *= i
  if ans > 10**18:
    ans = -1
    break
if 0 in l:
  ans = 0
print(ans)
S = input()
if S = "AAA" or S = "BBB":
  print("NO")
else:
  print("YES")

### FIXED CODE ###

S = input()
if S == "AAA" or S == "BBB":
  print("No")
else:
  print("Yes")
a, b = map(int, input().split())
if a < 1 or b < 1:
    print(-1)
else:
    amin = a*100//8 + ((a*100)%8 and 1)
    amax = (a+1)*100//8 + (max((a+1)*100)%8, 1) or 1)
    bmin = b*100//10 + ((b*100)%10 and 1)
    bmax = (b+1)*100//10 + (max(((b+1)*100)%10, 1) or 1)
    A = set(range(amin, amax))
    B = set(range(bmin, bmax))
    if (A & B):
        print(min(A&B))
    else:
        print(-1)

### FIXED CODE ###

a, b = map(int, input().split())
ass = 1 if ((100/8 * (a+1))-int(100/8 * (a+1))) else 0
asss = 1 if ((100/8 * a)-int(100/8 * a)) else 0
bss = 1 if ((100/10 * (b+1))-int(100/10 * (b+1))) else 0
bsss = 1 if ((100/10 * b)-int(100/10 * b)) else 0
As = set(range(int(100/8 * a)+asss, int(100/8 * (a+1))+ ass))
Bs = set(range(int(100/10 * b)+bsss, int(100/10 * (b+1))+bss))
if As & Bs:
    print(min(As&Bs))
else:
    print(-1)
import numpy as np
N=int(input())
A=sorted(list(map(int,input().split())))
# すべてTrueのbool配列dp
dp=np.ones(len(A),dtype=int)
for i in range(N):
	for j in range(i+1,N):
		if dp[j] == 0:
			continue
		if A[j]%A[i]==0:
			dp[j]=0
if A[0]==A[1]:
	dp[0]=0
print(sum(dp))

### FIXED CODE ###

import numpy as np
N=int(input())
A=sorted(list(map(int,input().split())))
Amax=A[-1]+1
B=np.zeros(Amax,dtype=int)
ans=0
#1～Amaxの範囲でjがA[i]の倍数の時,B[j]+=1
for i in A:
	for j in range(i,Amax,i):
		B[j]+=1
#B[i]==1:その数でしか割り切れない→count up
for i in A:
	if B[i]==1:
		ans+=1
print(ans)
n = int(input())
num = n - 1
price = []
date = 0
max_pro = -999999999

while(n>0):
    x = int(input())
    dataset = [date,x]
    price.append(dataset)
    n -= 1
    date += 1

price.sort(key=lambda price: price[1])

for i in range(0,num):
    j = num
    while(j > i):
        if(price[i][0]<price[j][0]):
            pro = price[j][1] - price[i][1]
            break
        j -= 1
    if (max_pro < pro):
        max_pro = pro
print ("{0}".format(max_pro))

### FIXED CODE ###

num= n = int(input())

price = []
max_pro = -999999999

while(n>0):
    x = int(input())
    price.append(x)
    n -= 1
min = price[0]
for i in range(1,num):
    pro = price[i]-min

    if(max_pro < pro):
        max_pro = pro
    if(min > price[i]):
        min = price[i]
print ("{0}".format(max_pro))
import sys

input = sys.stdin.readline

N = int(input())
L, R = [], []
length = []
for i in range(N):
	Li, Ri = map(int,input().split())
	L.append(Li)
	R.append(Ri)
	length.append(Ri-Li)

sindL = sorted(range(N), key=lambda k: L[k])
sindR = sorted(range(N), key=lambda k: R[k])
sind_len = sorted(range(N), key=lambda k: length[k])

indLmax = sindL[-1]
indRmin = sindR[0]

if indLmax==indRmin:
	ans = R[indRmin]-L[indLmax]+max(length)+2
else:
	lenmax_ind = sind_len[-1]
	if lenmax_ind==indLmax or lenmax_ind==indRmin:
		lenmax_ind = sind_len[-2]
		if lenmax_ind==indLmax or lenmax_ind==indRmin:
			lenmax_ind = sind_len[-3]
	ans = R[indRmin]-L[indLmax]+length[lenmax_ind]+2

	Qind = [0]*N
	Qind[indRmin] = 1
	ri = 1
	for li in range(0,N-1):
		QL, QR = L[sindL[li]], R[indRmin]
		Qind[sindL[li]] = 1
		while Qind[sindR[ri]]==1:
			ri += 1
			if ri==N: break
		PL, PR = L[indLmax], R[sindR[ri]]

		ans = max(ans,PR-PL+QR-QL+2)

print(ans)

### FIXED CODE ###

import sys

input = sys.stdin.readline

N = int(input())
L, R = [], []
length = []
for i in range(N):
	Li, Ri = map(int,input().split())
	L.append(Li)
	R.append(Ri)
	length.append(Ri-Li)

sindL = sorted(range(N), key=lambda k: L[k])
sindR = sorted(range(N), key=lambda k: R[k])
sind_len = sorted(range(N), key=lambda k: length[k])

indLmax = sindL[-1]
indRmin = sindR[0]

if N==2:
	ans = sum(length)+2
else:
	if indLmax==indRmin:
		ans = R[indRmin]-L[indLmax]+max(length)+2
	else:
		lenmax_ind = sind_len[-1]
		if lenmax_ind==indLmax or lenmax_ind==indRmin:
			lenmax_ind = sind_len[-2]
			if lenmax_ind==indLmax or lenmax_ind==indRmin:
				lenmax_ind = sind_len[-3]
		ans = max(0,R[indRmin]-L[indLmax]+1)+length[lenmax_ind]+1

		Qind = [0]*N
		Qind[indRmin] = 1
		ri = 1
		for li in range(0,N-1):
			QL, QR = L[sindL[li]], R[indRmin]
			Qind[sindL[li]] = 1
			while Qind[sindR[ri]]==1:
				ri += 1
			PL, PR = L[indLmax], R[sindR[ri]]

			ans = max(ans,max(0,PR-PL+1)+max(0,QR-QL+1))

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

ans = []
for row in src:
    ans.append(list(row))

dxy = [(-1, -1), (-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1)]
for y in range(H):
    for x in range(W):
        if src[y][x] == '#':
            continue
        c = 0
        for dx,  dy in dxy:
            if x + dx < 0 or x + dx > W - 1 or y + dy < 0 or y + dy > H - 1:
                continue
            if src[y + dy][x + dx] == '#':
                c += 1
        ans[y][x] = c


for row in ans:
    print(''.join(list(map(str, row))))

### FIXED CODE ###

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

ans = []
for i in S:
    ans.append(list(i))

dxy = [(-1, -1), (-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1)]

for y in range(H):
    for x in range(W):
        if S[y][x] == '#':
            continue
        c = 0
        for dx, dy in dxy:
            if x + dx < 0 or x + dx > W - 1 or y + dy < 0 or y + dy > H - 1:
                continue
            if S[y + dy][x + dx] == '#':
                c += 1
        ans[y][x] = c

for row in ans:
    print(''.join(list(map(str, row))))
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    S = [int(s) for s in input().split()]
    S.sort(reverse = True)

    result = []
    result.append(S[0])
    que = [True]*len(S)
    que[0] = False

    for i in range(N):
        for j in range(2**i):
            for k in range(len(S)):
                if que[k] and result[j]>S[k]:
                    result.append[S[k]]
                    que[k] = False
                    break
            else:
                print("No")
                break
        else:
            continue
        break
    else:
        print("Yes")

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys

def I(): return(int(sys.stdin.readline()))
def LI(): return([int(x) for x in sys.stdin.readline().split()])


def main():
    N = I()
    S = sorted(LI(),reverse=True)

    flag = [True]*len(S)

    cur = []
    cur.append(S[0])
    flag[0] = False

    for i in range(N):
        nxt = [x for x in cur]
        j = 0

        for k in range(len(S)):
            if j >= len(cur):
                break
            elif flag[k] and S[k]<cur[j]:
                nxt.append(S[k])
                j+=1
                flag[k] = False
        if len(cur) != j:
            return("No")
        cur = sorted(nxt,reverse=True)
    return("Yes")

if __name__ == "__main__":
    print(main())
import sys
input = sys.stdin.readline
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'
ups = np.zeros((H,W), dtype=int)
downs = np.zeros((H,W), dtype=int)
lefts = np.zeros((H,W), dtype=int)
rights = np.zeros((H,W), dtype=int)

for h in range(H):
    ups[h] = (ups[h-1] + 1) * S[h-1]
    downs[H-h-1] = (downs[H-h-1] + 1) * S[H-h-1]
for w in range(W):
    lefts[:, w] = (lefts[:, w-1] + 1) * S[w-1]
    rights[:, W-w-1] = (rights[:, W-w-1] + 1) * S[W-w-1]
print(np.amax((ups+downs+lefts+rights)*S)+1)


### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input().rstrip()) for _ in range(H)]) == '.'
ups = np.zeros((H,W), dtype=int)
downs = np.zeros((H,W), dtype=int)
lefts = np.zeros((H,W), dtype=int)
rights = np.zeros((H,W), dtype=int)

for h in range(1, H):
    ups[h] = (ups[h-1] + 1) * S[h-1]
    downs[H-h-1] = (downs[H-h] + 1) * S[H-h]
for w in range(1, W):
    lefts[:, w] = (lefts[:, w-1] + 1) * S[:, w-1]
    rights[:, W-w-1] = (rights[:, W-w] + 1) * S[:, W-w]
print(np.amax((ups+downs+lefts+rights)*S)+1)
def main():
  N, K = map(int, input().split(' '))
  # N本の木があって，i本目の木はh_i[m]
  # K本選んで電飾する.
  # 木の内一番高いのをh_max[m], 低いものをh_min[m]
  # min(h_max - h_min)をしたい.
  trees = [int(input()) for _ in range(N)]
  trees.sort()
  trees = [n - trees[0] for n in trees]
  # print(trees[K-1] - trees[0]) -> これだと，最初の方はかなり分散が大きい配列で，後ろの方が分散が小さい配列だとダメ
  # 例[0, 100, 101, 102] から2個選ぶ時, 上記だと100が帰ってくる.
  MIN = 100000000000000
  # print(trees)
  for n in range(K):
    t = trees[n+K-1] - trees[n]
    print(trees[n], trees[n+K-1])
    MIN = min(t, MIN)
  print(MIN)
main()

### FIXED CODE ###

def main():
  N, K = map(int, input().split(' '))
  # N本の木があって，i本目の木はh_i[m]
  # K本選んで電飾する.
  # 木の内一番高いのをh_max[m], 低いものをh_min[m]
  # min(h_max - h_min)をしたい.
  trees = [int(input()) for _ in range(N)]
  trees.sort()
  trees = [n - trees[0] for n in trees]
  # print(trees[K-1] - trees[0]) -> これだと，最初の方はかなり分散が大きい配列で，後ろの方が分散が小さい配列だとダメ
  # 例[0, 100, 101, 102] から2個選ぶ時, 上記だと100が帰ってくる.
  # MIN = 100000000000000
  # print(trees)
  # for n in range(K):
  # for n in range(N - K + 1):
  #   t = trees[n+K-1] - trees[n]
  #   MIN = min(t, MIN)
  MIN = min([trees[n+K-1] - trees[n] for n in range(N-K+1)])
  print(MIN)

main()
n,a,b=map(int,input().split())
ans=0
if (b-a)%2 == 0:
	ans = (b-a)//2
else:
	ans = min(n-a, b-1, (b-a-1)//2
print(ans)

### FIXED CODE ###

n,a,b=map(int,input().split())
ans=0
if (b-a)%2 == 0:
	ans = (b-a)//2
else:
	if (b-1) < (n-a):
		ans = min(n-a, b-1, a+(b-a-1)//2)
	else:
		ans = min(n-a, b-1, n-b+1+(b-a-1)//2)
print(ans)
for xy in range(h*w):
    i=xy//w
    j=xy%w
    z=a[i][j]-b[i][j]
    if i==0 and j==0:
        x[0].add(abs(a[0][0]-b[0][0]))
    elif i==0 and j!=0:
        for k in x[j-1]:
            if abs(k+z)<81: x[j].add(abs(k+z))
            elif abs(k-z)<81: x[j].add(abs(k-z))
    elif i%2:
        if j==0:
            for k in x[0]:
                if abs(k+z)<81: y[0].add(abs(k+z))
                if abs(k-z)<81: y[0].add(abs(k-z))
        else:
            for k in x[j]:
                if abs(k+z)<81: y[j].add(abs(k+z))
                if abs(k-z)<81: y[j].add(abs(k-z))
            for k in y[j-1]:
                if abs(k+z)<81: y[j].add(abs(k+z))
                if abs(k-z)<81: y[j].add(abs(k-z))
    else:
        if j==0:
            for k in y[0]:
                if abs(k+z)<81: x[0].add(abs(k+z))
                if abs(k-z)<81: x[0].add(abs(k-z))
        else:
            for k in y[j]:
                if abs(k+z)<81: x[j].add(abs(k+z))
                if abs(k-z)<81: x[j].add(abs(k-z))
            for k in x[j-1]:
                if abs(k+z)<81: x[j].add(abs(k+z))
                if abs(k-z)<81: x[j].add(abs(k-z))
    if j==w-1 and i%2==0:
        y=[set([]) for _ in range(w)]
        ans=min(x[-1])
    elif j==w-1:
        x=[set([]) for _ in range(w)]
        ans=min(y[-1])
print(ans)


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
H,W = map(int,readline().split())
A = [list(map(int,readline().split())) for _ in range(H)]
B = [list(map(int,readline().split())) for _ in range(H)]
 
X = (H + W) * 80
# X点持った状態から始める
dp = [[0] * W for _ in range(H)]
d = abs(A[0][0] - B[0][0])
dp[0][0] = (1 << (X - d))
for h in range(H):
    for w,(a,b) in enumerate(zip(A[h],B[h])):
        if h == w == 0:
            continue
        d = abs(a - b)
        x = 0
        if h != 0:
            x |= (dp[h-1][w] << d) 
            x |= (dp[h-1][w] >> d)
        if w != 0:
            x |= (dp[h][w-1] << d) 
            x |= (dp[h][w-1] >> d)
        dp[h][w] = x
 
dp = dp[-1][-1]
 
B = bin(dp)[2:]
can_make = [i - X for i,b in enumerate(B[::-1]) if b == '1']
 
answer = min(x if x >= 0 else -x for x in can_make)
print(answer)
N = int(input())
H =list(map(int, input().split()))
count = []
count_tmp = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        count_tmp += 1
        if i == N-2:
            count.append(count_tmp)
    else:
        count.append(count_tmp)
        count_tmp = 0
print(max(count))

### FIXED CODE ###

N = int(input())
H =list(map(int, input().split()))
count = []
count_tmp = 0
if N == 1:
    print(0)
else:
    for i in range(N-1):
        if H[i] >= H[i+1]:
            count_tmp += 1
            if i == N-2:
                count.append(count_tmp)
        else:
            count.append(count_tmp)
            count_tmp = 0
    print(max(count))
#abc148c
import math

a,b=map(int,input().split())
print((a*b)//math.gcd(a,b))


### FIXED CODE ###

#abc148c
from fractions import gcd

a,b=map(int,input().split())
print((a*b)//gcd(a,b))
MAX = 10**6
MOD = 10**9+7

fac = [0] * (MAX+1)
finv = [0] * (MAX+1)
inv = [0] * (MAX+1)

def comb_init():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX+1):
        fac[i] = fac[i-1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i-1] * inv[i] % MOD

def comb(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD


if __name__ == '__main__':
    k = int(input())
    s = input()
    n = len(s)
    comb_init()
    ans = 0
    for i in range(k+1):
        val = comb(i+n-1, n-1)
        val *= pow(25, i, MOD)
        val %= MOD
        val *= pow(26, k-i, MOD)
        val %= MOD
        ans += val
        ans %= MOD
    print(ans)


### FIXED CODE ###

MAX = 2*10**6
MOD = 10**9+7

fac = [0] * (MAX+1)
finv = [0] * (MAX+1)
inv = [0] * (MAX+1)

def comb_init():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX+1):
        fac[i] = fac[i-1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i-1] * inv[i] % MOD

def comb(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD


if __name__ == '__main__':
    k = int(input())
    s = input()
    n = len(s)
    comb_init()
    ans = 0
    for i in range(k+1):
        val = comb(i+n-1, n-1)
        val *= pow(25, i, MOD)
        val %= MOD
        val *= pow(26, k-i, MOD)
        val %= MOD
        ans += val
        ans %= MOD
    print(ans)
a,b = input().split()
if hex(a)>hex(b):
  print('>')
else if hex(a)<hex(b):
  print('<')
else if hex(a)==hex(b):
  print('=')

### FIXED CODE ###

a,b = input().split()
if a>b:
  print('>')
elif a<b:
  print('<')
elif a==b:
  print('=')
a,b  = map(int,input().split())
ans = 0
if a=>b:
  ans += a
  a -= 1
else:
  ans += b
  b-=1

if a=>b:
  ans += a
  a -= 1
else:
  ans += b
  b-=1
  
print(ans)


### FIXED CODE ###

a,b  = map(int,input().split())
ans = 0
if a>=b:
  ans += a
  a -= 1
else:
  ans += b
  b-=1

if a>=b:
  ans += a
  a -= 1
else:
  ans += b
  b-=1
  
print(ans)
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18

N, M = map(int, raw_input().split())
cost = [0,2,5,5,4,5,6,3,7,6]
A = sorted(map(int, raw_input().split()))

DP = [0] + [-1] * N * 2
ans = [0, 0] * N

for i in range(1, N + 1):
    for j in A:
        pos = i - cost[j]
        if min(pos, DP[pos], DP[pos] + 1 - DP[i]) >= 0:
            DP[i], ans[i] = DP[pos] + 1, j

S, pos = "", N
while pos:
    S += str(ans[pos])
    pos -= cost[ans[pos]]

print S

### FIXED CODE ###

#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18

N, M = map(int, raw_input().split())
cost = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}
A = map(int, raw_input().split())

DP = [0] + [-1] * N
ans = [0] * N + [0]

for i in range(1, N + 1):
    for j in range(10)[::-1]:
        if not j in A:
            continue
        if cost[j] > i:
            continue
        if DP[i - cost[j]] < 0:
            continue
        if DP[i] < DP[i - cost[j]] + 1:
            DP[i] = DP[i - cost[j]] + 1
            ans[i] = j

S = ""
pos = N
while pos != 0:
    S += str(ans[pos])
    pos -= cost[ans[pos]]

print S
def gcd(a, b) -> int:
  if(a < b):
    tmp = a
    a = b
    b = tmp
  if b == 0:
    return a
  return gcd(a % b, b)

N = int(input())
ans = 1
for i in range(N):
  t = int(input())
  g = gcd(ans, t)
  ans = int(ans * (t / g))
print(ans)

### FIXED CODE ###

def gcd(a, b) -> int:
  if(a < b):
    tmp = a
    a = b
    b = tmp
  if b == 0:
    return a
  return gcd(a % b, b)

def lcm(a, b) -> int:
  g = gcd(a, b)
  return a * (b // g)

N = int(input())
ans = int(1)
for i in range(N):
  t = int(input())
  ans = lcm(ans, t)
print(ans)
p,q,r = input().split()
print(sum(p,q,r) - max(p,q,r))

### FIXED CODE ###

p,q,r = input().split()
p = int(p)
q = int(q)
r = int(r)
print((p + q + r) - max(p,q,r))
""""
E-Knapsack2
Wが10**9まであるのでdpの置き方を工夫する。
dp[i]:=価値がiのときのナップザックの重さ
""""
N,W = map(int,input().split())
dp = [0]+[W+1]*(N*10**3)
for i in range(N):
    w,v = map(int,input().split())
    for j in range(N*10**3+1-v)[::-1]:
        dp[j+v] = min(dp[j+v],dp[j]+w)
for i in range(N*10**3+1)[::-1]:
    if dp[i]<=W:
        print(i)
        exit()

### FIXED CODE ###

"""
E-Knapsack2
Wが10**9まであるのでdpの置き方を工夫する。
dp[i]:=価値がiのときのナップザックの重さ
"""
N,W = map(int,input().split())
dp = [0]+[W+1]*(N*10**3)
for i in range(N):
    w,v = map(int,input().split())
    for j in range(N*10**3+1-v)[::-1]:
        dp[j+v] = min(dp[j+v],dp[j]+w)
for i in range(N*10**3+1)[::-1]:
    if dp[i]<=W:
        print(i)
        exit()
n = int(input())
A = list(map(int, input().split()))

dp = [0] * (2*(10**5))

for a in A:
    dp[a] += 1

for i in range(1, len(dp)):
    if dp[i]:
        for j in range(i+i, len(dp), i):
            dp[j] = 0
print(dp.count(1))


### FIXED CODE ###

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

dp = [0] * (10**6+1)

for a in A:
    dp[a] += 1

for i in range(1, len(dp)):
    if dp[i]:
        for j in range(i+i, len(dp), i):
            dp[j] = 0
print(dp.count(1))
a,b,k = map(int,input().split())
    ans = []
    for i in range(k):
        if a+i not in ans and a+i <=b:ans.append(a+i)
        if b-i not in ans and b-i >=a:ans.append(b-i)
    ans.sort()
    print(*ans)

### FIXED CODE ###

a,b,k = map(int,input().split())
ans = []
for i in range(k):
    if a+i not in ans and a+i <=b:ans.append(a+i)
    if b-i not in ans and b-i >=a:ans.append(b-i)
ans.sort()
print(*ans)
N = int(input())
K = int(input())
ans = 1
for i in range(N)
	if ans < K:
		ans *= 2
	else:
		ans += K
print(ans)

### FIXED CODE ###

N = int(input())
K = int(input())
ans = 1
for i in range(N):
	if ans < K:
		ans *= 2
	else:
		ans += K
print(ans)
s=input()
n=len(s)
list1=['R','U','D']
list2=['L','U','D']
listg=[]
listk=[]
for i in range(n):
  if i%2!=0:
    listg.append(i)
  else:
    listk.append(i)
list3=[]
for g in listg:
  if s[g] in list2:
    list3.append(g)
list4=[]
for k in listk:
  if s[k] in list1:
    list4.append(k)
if len(list3)==len(listg) and len(list4)=len(listk):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s=input()
n=len(s)
list1=['R','U','D']
list2=['L','U','D']
listg=[]
listk=[]
for i in range(n):
  if i%2!=0:
    listg.append(i)
  else:
    listk.append(i)
list3=[]
for g in listg:
  if s[g] in list2:
    list3.append(g)
list4=[]
for k in listk:
  if s[k] in list1:
    list4.append(k)
if len(list3)==len(listg) and len(list4)==len(listk):
  print('Yes')
else:
  print('No')
N, K, X, Y, = map(int, input().split())

if N <= K:
    print(N * X)

else:
    print(K * X + (N - K) * Y)


### FIXED CODE ###

N = int(input())    # 宿泊数
K = int(input())    # 単価が切り替わる泊数
X = int(input())    # 単価a
Y = int(input())    # 単価b


if N <= K:
    a = N * X
else:
    a = K * X + Y * (N - K)

print(a)
sabc=[list(input()) for _ in range(3)]
abc=[0,0,0]
lsabc=['a','b','c']
lsABC=['A','B','C']
def func(n):
    num=lsabc.index(sabc[n][abc[n]])
    abc[num]+=1
    if abc[num]==len(sabc[num])-1:
        print(lsABC[num])
        exit()
    func(num)
func(0)


### FIXED CODE ###

sabc=[list(input()) for _ in range(3)]
abc=[0,0,0]
lsabc=['a','b','c']
lsABC=['A','B','C']
def func(turn):
    if abc[turn]==len(sabc[turn]):
        print(lsABC[turn])
        exit()
    next=lsabc.index(sabc[turn][abc[turn]])
    abc[turn]+=1
    func(next)
func(0)
if L > 0:
    k = N*(L-1) + (N * (N+1))//2 - L
    print(k)
elif L == 0:
    print( (N-1) * N //2)
else: 
    if L+N-1 >=0:
        k = N*(L-1) + (N * (N+1))//2
        print(k)
    else:
        k = N*(L-1) + (N * (N+1))//2 - (L+N-1)
        print(k)

### FIXED CODE ###

N,L = map(int,input().split())
if L > 0:
    k = N*(L-1) + (N * (N+1))//2 - L
    print(k)
elif L == 0:
    print( (N-1) * N //2)
else: 
    if L+N-1 >=0:
        k = N*(L-1) + (N * (N+1))//2
        print(k)
    else:
        k = N*(L-1) + (N * (N+1))//2 - (L+N-1)
        print(k)
n,x = map(int,input().split())
a = list(map(int,input().split()))

cnt = 0

for i in range(1,n):
    if a[i-1]+a[i]<=x:
        pass
    else:
        if (a[i]+a[i-1])-x > a[i]
            a[i] = 0
            cnt += (a[i]+a[i-1])-x
        else:    
            cnt += (a[i]+a[i-1])-x
            a[i]-= (a[i]+a[i-1])-x

print(cnt)


### FIXED CODE ###

n,x = map(int,input().split())
a = list(map(int,input().split()))

cnt = 0

for i in range(n-1):
    if a[i]+a[i+1]<=x:
        pass
    else:
        if (a[i+1]+a[i])-x > a[i+1]:
            cnt += (a[i+1]+a[i])-x
            a[i+1] = 0

        else:
            cnt += (a[i+1]+a[i])-x
            a[i+1] -= (a[i+1]+a[i])-x

print(cnt)
N = int(input())
a = (input().split())
a_str = ''.join(a)
a_str2 = a_str
sum = 0
l_dict = {}
while len(a_str)>0:
    n = a.count(a_str[0])
    sum += int(n*(n-1)/2)
    l_dict[a_str[0]] = n
    a_str = a_str.replace(a_str[0],'')
for k in range(N):
    print(sum-l_dict[a_str2[k]]+1)


### FIXED CODE ###

N,M = map(int,input().split())
sum = 0
sum+=N*(N-1)/2
sum+=M*(M-1)/2
print(int(sum))
n, m = map(int, input().split())
a = [list(input()) for _ in range(n)]
b = [list(input()) for _ in range(m)]
f = False
for i in range(n):
    for j in range(n):
        if a[i][j] == b[0][0]:
            for k in range(m):
                for l in range(1, m):
                    if a[i+k][j+l] != b[k][l]:
                        f = True
                        break
                if f:
                    break
                print('Yes')
                exit()

print('No')

### FIXED CODE ###

n, m = map(int, input().split())
a = [list(input()) for _ in range(n)]
b = [list(input()) for _ in range(m)]

for i in range(n-m+1):
    for j in range(n-m+1):
        f = True
        for k in range(m):
            if a[i+k][j:j+m] != b[k]:
                f = False
                break
        if f:
            print('Yes')
            exit()

print('No')