Harryxun/stf_run huggingface dataset:
N = int(input())
S = str(input())

T = S[0:int(N) // 2]
W = S[int(N) // 2:int(N) + 1] 

if T == W:
	print('Yes')
else:
	print('No')


### FIXED CODE ###

input_int = input()

if input_int <= 100 and input_int >= 1:
	print(int(input_int) * int(input_int))
import numpy as np
import sys
input = sys.stdin.readline

R,C,K = map(int,input().split())

tb = np.zeros((R+1,C+1),dtype=np.int32)
dp = np.zeros((C+1,4),dtype=np.int64)
prev = np.zeros(C+1,dtype=np.int64)

for i in range(K):
    r,c,v = map(int,input().split())
    tb[r][c] = v

for i in range(1,R+1):
    for j in range(1,C+1):
        for k in range(4):
            dp[j][k] = dp[j-1][k]
            if k > 0:
                dp[j][k] = max(dp[j][k],dp[j-1][k-1]+tb[i][j])
            if k == 0:
                dp[j][k] = max(dp[j][k],prev[j])
            elif k == 1:
                dp[j][k] = max(dp[j][k],prev[j]+tb[i][j])
    prev = np.max(dp,axis=1)

print(prev[C])


### FIXED CODE ###

import sys
input = sys.stdin.readline

R,C,K = map(int,input().split())

dp = [[0]*4 for i in range(C+1)]
prev = [0]*(C+1)
tb = [[0]*(C+1) for i in range(R+1)]

for i in range(K):
    r,c,v = map(int,input().split())
    tb[r][c] = v

for i in range(1,R+1):
    for j in range(1,C+1):
        pmx = 0
        for k in range(4):
            mx = dp[j-1][k]
            if k > 0:
                mx = max(mx,dp[j-1][k-1]+tb[i][j])
            if k == 0:
                mx = max(mx,prev[j])
            elif k == 1:
                mx = max(mx,prev[j]+tb[i][j])
            dp[j][k] = mx
            pmx = max(pmx,mx)
        prev[j] = pmx

print(prev[C])
n=int(input())
s=list(input())
for i in s:
    if s[i]=="a" and s[i+1]=="b" and s[i+2]=="c":
        total+=1
print("total")

### FIXED CODE ###

n=int(input())
s=list(input())
total=0

for i in range(0,n-2):
    if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
        total+=1
print(total)
def card(n,m):
    try:
        if n >= 0 and n < N and m >= 0 and m < M:
            if a[n][m] == 1:
                a[n][m] = 0
            else:
                a[n][m] = 1
    except:
        None

count = 0
N, M = map(int,input().split())
a = [[0]*N for i in range(M)]

if N == 1 and M == 1:
    print(1)
elif N == 1 and M != 1:
    print(M-2)
else:
    print((N-2)*(M-2))


### FIXED CODE ###

N, M = map(int,input().split())

if N == 1 or M == 1:
    if N + M == 2:
        print(1)
    else:
        print(N*M-2)
else:
    print((N-2)*(M-2))
K, A, B = map(int, raw_input().split())

if B - A <= 2:
    print K + 1
    exit()

S = 1

M = min(K, A-1)
K -= M
S += M

S += K / 2 * (B - A)
K %= 2
S += K

print S


### FIXED CODE ###

K, A, B = map(int, raw_input().split())

if B - A <= 2:
    print K + 1
    exit()

S = 1

M = min(K, A-1)
K -= M
S += M

S += K / 2 * (B - A)
K %= 2
S += K

print S
a,b = map(int,input().split())

if a == 2 or b == 2;
	print('No')
else:
	print('Yes')

### FIXED CODE ###

a,b = map(int,input().split())
 
if a == 2 or b == 2:
	print('No')
else:
	print('Yes')
S = input()

def divide_str_to_list(s, before):
    for i in range(1, len(s)):
        if s[0:i] != before and s[i:] != s[0:i]:
            return 1 + divide_str_to_list(s[i:], s[0:i])
    return 1

print(divide_str_to_list(S, ""))


### FIXED CODE ###

S = input()
before = ""

count = 0
i = 0
while i < len(S):
    for l in range(1, len(S) - i):
       if S[i:i+l] != before and S[i:i+l] != S[i+l:]:
           count += 1
           before = S[i:i+l]
           break
    i += l

print(count+1)
#!/usr/bin/env python3
math_inf = float('inf')  # the Python of AtCoder is too old

def solve(n, m, a):
    cost = [ math_inf, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]

    small = [ None ] * min(100, n)
    small[0] = 0
    for i in range(1, len(small)):
        small[i] = max([ small[i - cost[a_i]] * 10 + a_i for a_i in a if cost[a_i] <= i ] + [ - math_inf ])

    min_cost, min_cost_a_i = min([ (cost[a_i], a_i) for a_i in a ])
    s = ''
    while n:
        k = (n - min_cost) // min_cost
        c = min_cost_a_i
        k, c = max([ ((n - cost[a_i]) // min_cost, a_i) for a_i in a if n - cost[a_i] >= 100 or small[n - cost[a_i]] >= 0 ])
        n -= cost[c]
        s += str(c)
    return s


n, m = map(int, input().split())
a = list(map(int, input().split()))
print(solve(n, m, a))


### FIXED CODE ###

#!/usr/bin/env python3
math_inf = float('inf')  # the Python of AtCoder is too old

def solve(n, m, a):
    cost = [ math_inf, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
    dp = [ None ] * (n + 1)
    dp[0] = 0
    for i in range(1, len(dp)):
        dp[i] = max([ dp[i - cost[a_i]] * 10 + a_i for a_i in a if cost[a_i] <= i ] + [ - math_inf ])
    return str(dp[n])


n, m = map(int, input().split())
a = list(map(int, input().split()))
print(solve(n, m, a))
N = int(input())
A = list(map(int, input().split()))

def sunuke(b):
    ret = 0
    sub = 1
    for a in A:
        ret += abs(a - (b+ sub))
        sub += 1
    return ret


B = []

sub = 1
for a in A:
    b = a - sub
    B.append(b)
    sub += 1

B.sort()
b1 = N // 2
b2 = b1 + 1

b1_s = sunuke(B[b1])
b2_s = sunuke(B[b2])
if b1_s < b2_s:
    print(b1_s)
else:
    print(b2_s)


### FIXED CODE ###

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

def sunuke(b):
    ret = 0
    sub = 1
    for a in A:
        ret += abs(a - (b+ sub))
        sub += 1
    return ret


B = []

sub = 1
for a in A:
    b = a - sub
    B.append(b)
    sub += 1

B.sort()
b1 = N // 2
if N < 3:
    print(sunuke(B[b1]))
    exit()

b2 = b1 + 1
b1_s = sunuke(B[b1])
b2_s = sunuke(B[b2])
if b1_s < b2_s:
    print(b1_s)
else:
    print(b2_s)
N,K,C=map(int,input().split())
S=input()
i=0
data1=[0 for i in range(0,N)]
if S[0]=='o':
    for j in range(0,C+1):
        data1[j]=(1,C+1)
    i=C+1
else:
    data1[0]=(0,1)
    i=1
while N-1>=i:
    if S[i]=='o':
        for j in range(0,C+1):
            if N>i+j:
                data1[i+j]=(data1[i-1][0]+1,min(i+C+1,N))
        i+=C+1
    else:
        data1[i]=(data1[i-1][0],i+1)
        i+=1

data2=[0 for i in range(0,N)]
if S[-1]=='o':
    for j in range(0,C+1):
        data2[j]=1
    i=C+1
else:
    data2[0]=1
    i=1
while N-1>=i:
    if S[-i-1]=='o':
        for j in range(0,C+1):
            if N>i+j:
                data2[i+j]=data2[i-1]+1
        i+=C+1
    else:
        data2[i]=data2[i-1]
        i+=1

for i in range(0,N):
    if i==0:
        if K>data2[N-2]:
            print(i+1)
    elif N-1>i:
        work,nextday=data1[i-1]
        if nextday!=N:
            nextday=max(nextday,i+1)
            if K>work+data2[N-1-nextday]:
                print(i+1)
        else:
            if K>work:
                print(i+1)
    elif i==N-1:
        if K>data1[N-2][0]:
            print(i+1)

### FIXED CODE ###

N,K,C=map(int,input().split())
S=input()
i=0
data1=[0 for i in range(0,N)]
if S[0]=='o':
    for j in range(0,C+1):
        if N>j:
            data1[j]=(1,min(N,C+1))
    i=C+1
else:
    data1[0]=(0,1)
    i=1
while N-1>=i:
    if S[i]=='o':
        for j in range(0,C+1):
            if N>i+j:
                data1[i+j]=(data1[i-1][0]+1,min(i+C+1,N))
        i+=C+1
    else:
        data1[i]=(data1[i-1][0],i+1)
        i+=1

data2=[0 for i in range(0,N)]
if S[-1]=='o':
    for j in range(0,C+1):
        if N>j:
            data2[j]=1
    i=C+1
else:
    data2[0]=0
    i=1
while N-1>=i:
    if S[-i-1]=='o':
        for j in range(0,C+1):
            if N>i+j:
                data2[i+j]=data2[i-1]+1
        i+=C+1
    else:
        data2[i]=data2[i-1]
        i+=1

if N==1:
    print(1)
else:
    for i in range(0,N):
        if S[i]=='o':
            if i==0:
                if K>data2[N-2]:
                    print(i+1)
            elif N-1>i:
                work,nextday=data1[i-1]
                if nextday!=N:
                    nextday=max(nextday,i+1)
                    if K>work+data2[N-1-nextday]:
                        print(i+1)
                else:
                    if K>work:
                        print(i+1)
            elif i==N-1:
                if K>data1[N-2][0]:
                    print(i+1)
S = input()
K = int(input())

itr = 0
cnt = 1
len_cnt = []
for x in S :
  if itr == 0 :
    pre = x
    itr += 1
    continue
  now = x
  if pre == now :
    cnt += 1
    itr += 1
    if itr == len(S) :
      len_cnt.append(cnt)
    continue
  if pre != now :
    len_cnt.append(cnt)
    itr+=1
    if itr == len(S) and cnt == 1 :
      len_cnt.append(cnt)
    cnt = 1
    pre = x
    continue

ans = 0
for x in len_cnt :
  if x == 1 :
    continue
  else :
    ans += int(x / 2)

if S[0] == S[-1] and len_cnt[-1] > 1 and len_cnt[-1] % 2 == 1 and K > 1:
  ans += 1

ANS = K * ans
if len_cnt[-1] % 2 == 1 and len_cnt[-1] != 1 :
  ANS -= 1
print(ANS)

### FIXED CODE ###

S = input()
K = int(input())

flag = False

itr = 0
cnt = 1
len_cnt = []
for x in S :
  if itr == 0 :
    pre = x
    itr += 1
    continue
  now = x
  if pre == now :
    cnt += 1
    itr += 1
    if itr == len(S) :
      len_cnt.append(cnt)
    continue
  if pre != now :
    len_cnt.append(cnt)
    itr+=1
    if itr == len(S) and cnt == 1 :
      len_cnt.append(cnt)
    cnt = 1
    pre = x
    continue

if sum(len_cnt) != len(S) :
  len_cnt.append(1)

if len(len_cnt) == 1 :
  print(int(len_cnt[0] * K / 2))
  exit()

ans = 0
for x in len_cnt :
  if x == 1 :
    continue
  else :
    ans += int(x / 2)

# if S[0] == S[-1] and len_cnt[-1] > 1 and len_cnt[-1] % 2 == 1 and K > 1:
#   ans += 1
if S[0] == S[-1] and len_cnt[-1] % 2 == 1 and len_cnt[0] % 2 == 1 :
  ans += 1
  flag = True

ANS = K * ans
# print (ANS, len_cnt)
if flag :
  ANS -= 1

# if S[0] ==S[-1] and len_cnt[-1] % 2 == 1 and len_cnt[-1] != 1 :
#   ANS -= 1
print(ANS)
import sys
sys.setrecursionlimit(100000)
INF = 1000000007
n,m= map(int,input().split())
a = [0]*m
for i in range(m):
    a[i] = int(input())

step = [0]*100000
step[0] =1
step[1] =1
step[2] =2
for i in range(3,100000):
    step[i] = step[i-1] + step[i-2]

l = [a[0]-1]
for i in range(1,m):
    l.append(a[i]-a[i-1]-2)
l.append(n-a[m-1]-1)

ans = 1

for i in range(m+1):
    if step[l[i]] < 0:
        ans = 0
        break
    ans = ans*step[l[i]]
    if ans >= INF:
        ans = ans % INF

print(ans)
    

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
INF = 1000000007
n,m= map(int,input().split())
a = [0]*m
for i in range(m):
    a[i] = int(input())

step = [0]*(n+10)
step[0] =1
step[1] =1
step[2] =2
for i in range(3,n+10):
    step[i] = step[i-1] + step[i-2]
if m != 0:
    l = [a[0]-1]
    for i in range(1,m):
        l.append(a[i]-a[i-1]-2)
    l.append(n-a[m-1]-1)

    ans = 1

    for i in range(m+1):
        if l[i] < 0:
            ans = 0
            break
        ans = ans*step[l[i]]
        if ans >= INF:
            ans = ans % INF
if m == 0:
    ans = step[n] % INF
print(ans)
N, K = map(int,input().split()) # 複数の数字を変数に格納

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
  
red = N - K
blue = K
division = 10 ** 9 + 7

for i in range(K):
    if red == 0 and i == 0:
        print("1")
    elif i > red:
        print("0")
    else:
        tmp_blue = cmb(blue-1,i)
        tmp_red = 1
        for j in range(i+1):
            tmp_red = tmp_red * (red+1-j) / (j+1)
        result = int(tmp_blue * tmp_red % division)
        print("{}".format(result))


### FIXED CODE ###

N, K = map(int,input().split()) # 複数の数字を変数に格納

red = N - K
blue = K
division = 10 ** 9 + 7

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under % division
  
for i in range(K):
    if i > red:
        print("0")
    else:
        tmp_blue = cmb(blue-1,i) % division
        tmp_red = cmb(red+1,red-i)
        result = int(tmp_blue * tmp_red % division)
        print("{}".format(result))
def main():
	A, B, T = map(int, input().split())
	print(B*(T//A)

### FIXED CODE ###

def main():
  test = input()
  A, B, T = map(int, test.split(" "))
  print(B*(T//A))
  return 

if __name__ == "__main__":
    main()
import sys
import itertools


class Treasure:
    def __init__(self, value, weight):
        self.value = value
        self.weight = weight



def solv(treasures, w_limit):
    comb = t_combinations(treasures)
    ts = filter(lambda x: t_sum_weight(x) <= w_limit, comb)
    max_value = max(map(lambda x: t_sum_value(x), ts))
    ts2 = filter(lambda x: t_sum_value(x) == max_value, ts)
    if len(ts2) == 1:
        return (ts2[0].value, ts2[0].weight)
    else:
        rt = rightest(ts2)
        return (t_sum_value(rt), t_sum_weight(rt))


def t_combinations(t):
    l = len(t)
    r = []
    for x in range(1, l+1):
        for y in itertools.combinations(t, x):
            r.append(y)
    return r


def t_sum_weight(ts):
    return sum(map(lambda x: x.weight, ts))


def t_sum_value(ts):
    return sum(map(lambda x: x.value, ts))


def rightest(tss):
    return reduce(lambda a, b: take_right(a, b), tss)


def take_right(a, b):
    if t_sum_weight(a) <= t_sum_weight(b):
        return a
    else:
        return b


case = 0

while True:
    weight_limit = int(sys.stdin.readline())
    case += 1
    if weight_limit == 0:
        exit()
    n = int(sys.stdin.readline())
    treasures = []
    for i in range(n):
        v, w = map(int, sys.stdin.readline().split(','))
        treasures.append(Treasure(v, w))
    value, weight = solv(treasures, weight_limit)
    print 'Case ' + str(case) + ':'
    print value
    print weight

### FIXED CODE ###


import sys
import itertools


class Treasure:
    def __init__(self, value, weight):
        self.value = value
        self.weight = weight



def solv(treasures, w_limit):
    dp = []
    dp.append(0)
    for n in range(w_limit):
        dp.append(-1)
    for i in treasures:
        for j in range(w_limit - i.weight, -1, -1):
            if dp[j] >= 0:
                dp[j + i.weight] = max(dp[j + i.weight], dp[j] + i.value)
    p = 0
    q = 0
    for i in range(w_limit + 1):
        if dp[i] > p:
            p = dp[i]
            q = i
    return (p, q)






case = 0

while True:
    weight_limit = int(sys.stdin.readline())
    case += 1
    if weight_limit == 0:
        exit()
    n = int(sys.stdin.readline())
    treasures = []
    for i in range(n):
        v, w = map(int, sys.stdin.readline().split(','))
        treasures.append(Treasure(v, w))
    value, weight = solv(treasures, weight_limit)
    print 'Case ' + str(case) + ':'
    print value
    print weight
N=int(input())
a=int(input())
b=int(input())
if(N==1):
    print("Hello World")
else :
    print(a+b)

### FIXED CODE ###

N=int(input())
if(N==1):
    print("Hello World")
else :
    a=int(input())
    b=int(input())
    print(a+b)
N = int(input(N))

if N % 2 == 0:
    print(1-(N/2)/2)
else:
    odd_N = N//2 + 1
    print(odd_N / N)

### FIXED CODE ###

N = int(input())

if N % 2 == 0:
    print(0.50000000000)
else:
    odd_N = N//2 + 1
    print(odd_N / N)
import math

def fac(x):
    if x<=1:
        return 1
    s=1
    for i in range(1,x+1):
        s=s*i
    return s
def com(m,n):
    return fac(m)/(fac(n)*fac(m-n))

temps=input().split()
n=int(temps[0])
m=int(temps[1])
sum=0
for i in range(m,n+1):
    sum=sum+com(n+1,i)
print(int(sum%(math.pow(10,9)+7)))



### FIXED CODE ###

import math

def fac(x):
    if x<=1:
        return 1
    s=1
    for i in range(1,x+1):
        s=s*i
    return s
def com(m,n):
    return fac(m)/(fac(n)*fac(m-n))


temps=input().split()
n=int(temps[0])
m=int(temps[1])
sum=0
for i in range(m,n+2):
    min=int((i-1)*i/2)
    max=int((2*n-i+1)*i/2)
    sum=sum+max-min+1
print(int(sum%(math.pow(10,9)+7)))
from collections import deque
import sys
sys.setrecursionlimit(20000)
#input = sys.stdin.readline
h,w = map(int,input().split())
a = [[j for j in input()] for i in range(h)]
used = [[0]*w for i in range(h)]
def dfs(x,y):
    if used[x][y]:
        return 0
    global go
    used[x][y] = 1
    if x-1 >=0 and a[x-1][y] != a[x][y]:
            go.add((x-1,y))
            dfs(x-1,y)
    if y-1 >=0 and a[x][y-1] != a[x][y]:
            go.add((x,y-1))
            dfs(x,y-1)
    if x+1 <h and a[x+1][y] != a[x][y]:
            go.add((x+1,y))      
            dfs(x+1,y)
    if y+1 <w and a[x][y+1] != a[x][y]:
            go.add((x,y+1))
            dfs(x,y+1)
ans = 0
for i in range(h):
    for j in range(w):
        go = set()
        if used[i][j]:
            continue
        dfs(i,j)
        kuro = 0
        siro = 0
        for k,l in go:
            if a[k][l] == "#":
                kuro += 1
            else:
                siro += 1
        ans += kuro*siro

print(ans)

### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(200000)
#input = sys.stdin.readline
h,w = map(int,input().split())
a = [[j for j in input()] for i in range(h)]
used = [[0]*w for i in range(h)]
def dfs(x,y):
    if used[x][y]:
        return 0
    global go
    used[x][y] = 1
    if x-1 >=0 and a[x-1][y] != a[x][y]:
            go.add((x-1,y))
            dfs(x-1,y)
    if y-1 >=0 and a[x][y-1] != a[x][y]:
            go.add((x,y-1))
            dfs(x,y-1)
    if x+1 <h and a[x+1][y] != a[x][y]:
            go.add((x+1,y))      
            dfs(x+1,y)
    if y+1 <w and a[x][y+1] != a[x][y]:
            go.add((x,y+1))
            dfs(x,y+1)
ans = 0
for i in range(h):
    for j in range(w):
        go = set()
        if used[i][j]:
            continue
        dfs(i,j)
        kuro = 0
        siro = 0
        for k,l in go:
            if a[k][l] == "#":
                kuro += 1
            else:
                siro += 1
        ans += kuro*siro

print(ans)
def soinsu(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n=int(input())
a=soinsu(n)
c=[]
if n>=2:
    for i in range(max(a)):
        c.append(0)
for i in a:
    c[i-1]+=1
if n>=2:
    f=max(c)
    s=[]
    for i in range(f+1):
        s.append(0)
    for i in c:
        s[i]+=1
z=0
g=[1]
d=1
e=1
while e<=f:
    d+=1
    e=d*(d+1)/2
    g.append(e)
for i in range(len(g)):
    g[i]=int(g[i])
for i in range(1,len(g)):
    z+=i*(sum(s[g[i-1]:g[i]]))


print(z)

### FIXED CODE ###

n=int(input())
import math
s=round(math.sqrt(n))+1

i=2
c1=0
c2=1
ans=0
while i<=s:
    if n%i==0:
        n//=i
        c1+=1
        if c1==c2:
            c1=0
            c2+=1
            ans+=1
    else:
        c2=1
        i+=1
        c1=0
if n>s:
    ans+=1
    
print(ans)
S = input()
C = 0
l = []
for s in S:
  if s == "R":
    C += 1
  else:
    l.append(C)
    C = 0
print(max(l))

### FIXED CODE ###

S = input()
C = 0
l = []
for s in S:
  if s == "R":
    C += 1
  else:
    l.append(C)
    C = 0
l.append(C)
print(max(l))
import sys

read = sys.stdin.read
sys.setrecursionlimit(10 ** 10)

N, *a = map(int, read().split())

memo = [[0] * N for _ in range(N)]
r = N % 2


def f(i, j):
    n = j - i + 1
    if i == j:
        if n % 2 == r:
            s = a[i]
            memo[i][j] = s
            return s
        else:
            s = -a[i]
            memo[i][j] = s
            return s
    if n % 2 == r:
        s = max(f(i, j - 1) + a[j], f(i + 1, j) + a[i])
    else:
        s = min(f(i, j - 1) - a[j], f(i + 1, j) - a[i])
    memo[i][j] = s
    return s


f(0, N - 1)
print(memo[0][N - 1])


### FIXED CODE ###

import sys

read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)


def solve():
    n, *a = map(int, read().split())
    a = tuple(a)
    dp = [[0] * n for _ in range(n)]
    for i in range(n):
        dp[i][i] = a[i]
    for i in range(n - 2, -1, -1):
        for j in range(i + 1, n):
            L = a[i] - dp[i + 1][j]
            R = a[j] - dp[i][j - 1]
            if L > R:
                dp[i][j] = L
            else:
                dp[i][j] = R
    return dp[0][n - 1]


print(solve())
from math import gcd
N = int(input())
A = list(map(int, input().split()))
tmp = gcd(A[0], A[1])
for a in A:
    tmp = gcd(tmp, a)
print(tmp)

### FIXED CODE ###

from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
tmp = gcd(A[0], A[1])
for a in A:
    tmp = gcd(tmp, a)
print(tmp)
N = int(input())

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

money = 1000

for i in range(N):
    t = money + (A[i + 1] - A[i]) * (money // A[i])
    money = max(money, t)

print(money)

### FIXED CODE ###

N = int(input())

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

money = 1000
kabu = 0

for i in range(len(A)-1):
    if kabu != 0:
        if A[i] >= A[i + 1]:
            money += kabu * A[i]
            kabu = 0

    else:
        if A[i] < A[i + 1]:
            kabu = money // A[i]
            money -= kabu * A[i]

if kabu != 0:
    money += kabu * A[len(A) - 1]
    
print(money)
import math


def main():
    H, W = [int(a) for a in input().split()]
    A = [[int(a) for a in input().split()] for _ in range(H)]

    od = None
    res = []
    for i in range(H):
        if i % 2 == 0:
            r = range(W)
        else:
            r = reversed(range(W))
        for j in r:
            cell = A[i][j]
            if od is None:
                if cell % 2 != 0:
                    od = i, j
            else:
                res.append((*od, i, j))
                if cell % 2 == 0:
                    od = i, j
                else:
                    od = None

    print(len(res))
    for a, b, c, d in res:
        print(a+1, b+1, c+1, d+1)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math


def main():
    H, W = [int(a) for a in input().split()]
    A = [[int(a) for a in input().split()] for _ in range(H)]

    od = None
    res = []
    for i in range(H):
        if i % 2 == 0:
            r = range(W)
        else:
            r = reversed(range(W))
        for j in r:
            cell = A[i][j]
            if od is None:
                if cell % 2 != 0:
                    od = i, j
            else:
                res.append((od[0],od[1], i, j))
                if cell % 2 == 0:
                    od = i, j
                else:
                    od = None

    print(len(res))
    for a, b, c, d in res:
        print(a + 1, b + 1, c + 1, d + 1)


if __name__ == '__main__':
    main()
n,n,x=input().strip()

### FIXED CODE ###

import math
n,x,t = map(int,input().split())
print(math.ceil(n/x)*t)
n,m = map(int,input().split())
a = [list(input())for i in range(n)]
b = [list(input())for i in range(m)]
count = 0
for x in range (m):
    #print(x)
    for y in range(n-m+1):
        #print(y)
        for z in range(n-m+1):
            for p in range(m):
                if b[x+p] == a[y+p][z:(z+m)]:
                    count += 1
                    #print("elif")
                    #print(count)
                    if count == m:
                        print("Yes")
                        exit()
                else:
                    count = 0
                    #print("else")
                    #print(count)
else:
    print("No")

### FIXED CODE ###

n,m = map(int,input().split())
a = [list(input())for i in range(n)]
b = [list(input())for i in range(m)]
for y in range(n-m+1):
    for z in range(n-m+1):
        count = 0
        for p in range(m):
            if b[p] == a[y+p][z:(z+m)]:
                count += 1
                if count == m:
                    print("Yes")
                    exit()
            else:
                count = 0
print("No")
list = map(int, raw_input().split())
print list[0] / list[1], list[0] % list[1], "&.5f" %(1.0*list[0] / list[1])

### FIXED CODE ###

list = map(int, raw_input().split())
print list[0] / list[1], list[0] % list[1], "%.5f" %(1.0*list[0] / list[1])
s = input()
print(f"{s[0]}{len(s) - 2}{s[-1]}")

### FIXED CODE ###

s = input()
print(s[0] + str(len(s) - 2) + s[-1])