# Serence

## 洛谷入门题 - 2

### P1909

P 老师需要去商店买 n 支铅笔作为小朋友们参加 NOIP 的礼物。她发现商店一共有 33 种包装的铅笔，不同包装内的铅笔数量有可能不同，价格也有可能不同。为了公平起 见，P 老师决定只买同一种包装的铅笔。

import math

num = int(input())
pen = []

for i in range(0,3):
a = input().split()
temp = [int(a[0]),int(a[1])]
pen.append(temp)

money = math.ceil(num / pen[0][0]) * pen[0][1]

for i in range(1,3):
c = math.ceil(num / pen[i][0])
temp = c * pen[i][1]

if money > temp:
money = temp

print(money)


### P1089

import math

money = 0
count = 0

ys = []

for i in range(0,12):
ys.append(int(input()))

for i in range(0,11):
if 300 - ys[i] < 0:
count = -(i+1)
break
else:
ci = (300 - ys[i]) // 100
money = money + 100 * ci
ys[i+1] -= (300 - ys[i]) - (100 * ci)

if 300 - ys[11] < 0:
count = -12
else:
ci = (300 - ys[11]) // 100
money += 100 * ci
sy = 300 - ys[11] - 100 * ci

if count < 0:
print(count)
else:
print(int(1.2 * money) + sy)


### P1423

import math

d = float(input())
i = 1
dd = 2

while d > dd:
dd += 2 * math.pow(0.98,i)
i += 1

print(i)


### P1424

a = input().split()
st = int(a[0])
t = int(a[1])
mt = 0

for i in range(0,t):
if st == 6:
mt += 1
elif st == 7:
mt += 1
st = 0

st += 1

print(250 * (t - mt))


x,y = input().split()

a = int(x)
b = int(y)

if a == 7:
n1 = 0
else:
n1 = 6-a

n2 = (b - 8 + a) // 7 * 5

if (b - 8 + a) % 7 == 6:
n3 = 5
else:
n3 = (b - 8 + a) % 7

total = (n1 + n2 + n3)*250
print(total)


### P1980

a = input().split()
count = 0

n = int(a[0])
which = a[1]

def dd(st,num):
return st[:num] + st[num+1:];

for i in range(1,n+1):
d = 0
s = str(i)
while d != -1:
d = s.find(which)
if d >= 0:
count += 1
s = dd(s,d)

print(count)


### P1008

$1,2, \cdots ,9$$9$ 个数分成 $3$ 组，分别组成 $3$ 个三位数，且使这 $3$ 个三位数构成 $1:2:3$ 的比例，试求出所有满足条件的 $3$ 个三位数。

for a in range(123,334):
b = a * 2
c = a * 3
if a // 100 + a // 10 % 10 + a % 10 + b // 100 + b // 10 % 10 + b % 10 + c // 100 + c // 10 % 10 + c % 10 == 45:
if (a // 100) * (a // 10 % 10) * (a % 10) * (b // 100) * (b // 10 % 10) * (b % 10) * (c // 100) * (c // 10 % 10) * (c % 10) == 362880:
print(str(a) + " " + str(b) + " " + str(c))


### P1427

a = input().split()

for k in range(len(a) - 2, -1, -1):
print(a[k], end=" ")


### P1428

a = int(input())
d = input().split()

b = [0]

for i in range(1,a):
c = 0
for k in range(0,i):
if d[i] > d[k]:
c += 1
b.append(c)

for each in b:
print(each,end=" ")


### P2141

a = int(input())
b = input().split()
count = 0
c = []

for i in range(0,a):
b[i] = int(b[i])

for i in range(0,len(b)):
for k in range(i + 1,a):
temp = b[i] + b[k]
if temp in b:
if temp not in c:
count += 1
c.append(temp)

print(count)


### P1567

a = int(input())
b = input().split()
count = []
temp = 1

for i in range(0,a):
b[i] = int(b[i])

t = b[0]

for i in range(1,a):
if b[i] > t:
t = b[i]
temp += 1
elif b[i] < t:
t = b[i]
count.append(temp)
temp = 1

print(max(count))


EOF