Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pysnooper # @pysnooper.snoop()
from pprint import pprint as pp
from pprint import pformat as pf

import math


if __name__ == '__main__':
    x = int(input())
    money = 100
    count = 0
    while not (money >= x):
        money = math.floor(money * 101 / 100)
        count += 1
    print(count)


### FIXED CODE ###

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

from pprint import pprint as pp
from pprint import pformat as pf

import math


if __name__ == '__main__':
    x = int(input())
    money = 100
    count = 0
    while not (money >= x):
        money = math.floor(money * 101 / 100)
        count += 1
    print(count)
def search(M, l, walkable):
    i, j = (l.pop(0))
    nexts = []
    if i !=0:
        nexts.append((i-1, j))
    if i != len(M)-1:
        nexts.append((i+1, j))
    if j != 0:
        nexts.append((i, j-1))
    if j != len(M[0])-1:
        nexts.append((i, j+1))

    for nex in nexts:
        x, y = nex
        if M[x][y] == '.' and not nex in walkable:
            l.append(nex)
            walkable.append(nex)

inp = ''
while '0 0' != (inp = input()):
    i, j = [int(x) for x in inp.split()]
    M = [input() for k in range(j)]
    l = []
    for n in range(j):
        if '@' in M[n]:
            l.append((n, M[n].find('@')))

    walkable = []
    while l:
        search(M, l, walkable)
    print(len(walkable)+1)

### FIXED CODE ###

import queue

def solve(w, h):
    q = queue.Queue()
    m = [['#' for i in range(w+2)] for j in range(h+2)]
    for i in range(h):
        inp = input()
        for j in range(w):
            m[i+1][j+1] = inp[j]
            if m[i+1][j+1] == '@':
                start = [i+1,j+1]
    q.put(start)
    c = 1
    while not q.empty():
        cur = q.get()
        XY = [(1,0), (-1, 0), (0, 1), (0, -1)]
        for x, y in XY:
            cx = cur[0]+x
            cy = cur[1]+y
            if m[cx][cy] == '.':
                m[cx][cy] = '#'
                q.put([cx, cy])
                c+=1
    return c

while True:
    w, h = [int(i) for i in input().split()]
    if w == 0 and h == 0:
        break
    print(solve(w,h))
n = int(input())
a = int(input())
b = int(input())
sum = 0

for i in range(1,n+1):
    if a<=(i//10000 + i//1000%10 + i//100%10 + i//10%10 + i%10)<=b:
        sum += i
print(sum)


### FIXED CODE ###

n,a,b = input().strip().split()
n,a,b = [int(n),int(a),int(b)]
sum = 0

for i in range(1,n+1):
    if a<=(i//10000 + i//1000%10 + i//100%10 + i//10%10 + i%10)<=b:
        sum += i
print(sum)
a, b, k = map(int,input().split())
ans_a = a - k
if ans_a < 0:
    ans_a = 0
    ans_b = b - abs(ans_a)
    if ans_b < 0 or k - a >= b:
        ans_b = 0
print(str(ans_a) + " " + str(ans_b))

### FIXED CODE ###

a, b, k = map(int, input().split())
if k < a:
    print(str(a - k) + " " + str(b))
elif a <= k and k < a + b:
    print(str(0) + " " + str(b - k + a))
elif k >= a + b:
    print(str(0) + " " + str(0))
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_prime_factors(n):
    import numpy as np
    factors = np.arange(0, n+1, 1, dtype=np.int64)
    for i in range(2, n+1):
        if factors[i] == i:
            np.minimum(factors[i*2::i], i, out=factors[i*2::i])
    return factors

#

def main():
    N=ii()
    A=lmis()
    factors = get_prime_factors(10**6)
    d_lcm = defaultdict(int)
    d = [None] * N
    for i, a in enumerate(A):
        d[i] = dd = defaultdict(int)
        p = a
        while p > 1:
            dd[factors[p]] += 1
            p //= factors[p]
        for key in dd.keys():
            d_lcm[key] = max(d_lcm[key], dd[key])
    ans = 0
    for dd in d:
        tmp = 1
        for p in d_lcm.keys():
            tmp *= p ** (d_lcm[p] - dd[p])
            tmp %= N1097
        ans += tmp
        ans %= N1097
    print(ans)


main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
import math
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    N = ii()
    A = lmis()
    l = 1
    for a in A:
        l = lcm(l, a)
    print(sum(l//a for a in A) % N1097)


main()
def solve(s):
    if s <= 10 ** 9:
        return 0, 0, 0, 1, 0, s
    X = 10 ** 9
    Y = (s - 1) // X + 1
    xy = X * Y - s
    lim = min(Y, int(xy ** 0.5))
    for y in range(1, lim + 1):
        x, m = divmod(xy, y)
        if x <= X and m == 0:
            return 0, 0, X, y, x, Y


s = int(input())
print(*solve(s))


### FIXED CODE ###

def solve(s):
    k = 10 ** 9
    if s <= k:
        return 0, 0, 1, 0, 0, s
    X = k
    while True:
        Y = (s - 1) // X + 1
        while Y <= k:
            xy = X * Y - s
            if xy == 0:
                return 0, 0, X, 0, 0, Y
            lim = min(Y, int(xy ** 0.5))
            for y in range(1, lim + 1):
                x, m = divmod(xy, y)
                if x <= X and m == 0:
                    return 0, 0, X, y, x, Y
            Y += 1
        X -= 1


s = int(input())
print(*solve(s))
x1, y1, x2, y2 = [int(iv) for iv in raw_input().split()]
print sqrt(abs(x2-x1)**2 + abs(y2-y1)**2)

### FIXED CODE ###

from math import sqrt
x1, y1, x2, y2 = [float(iv) for iv in raw_input().split()]
print sqrt(abs(x2-x1)**2 + abs(y2-y1)**2)
N = int(input())
A = list(map(int, input().split()))
chinpo = 0

for i in range(N):

    if A[i] > A[i+1]:
        A[i] -= 1
        if A[i] <= A[i+1]:
            chinpo += 1
    else:
        chinpo += 1

if chinpo == N-1:
    print("Yes")
else:
    print("No")



### FIXED CODE ###

N = int(input())
H = []
H = input().split(" ")
for i in range(N):
    H[i] = int(H[i])-1

ochinchin = True
for i in range(1, N):
    if H[i] < H[i-1]:
        H[i] += 1
        if H[i] < H[i-1]:
            ochinchin = False
            break
            

if ochinchin:
    print("Yes")
else:
    print("No")
n,m = list(map(int, input().split()))
a=list(map(int, input().split()))
a.sorted()
d=[a[i+1]-a[i] for i in range(m-1)]
d.sorted()
print(sum(d[:m-n]) if m>n else 0)

### FIXED CODE ###

n,m = list(map(int, input().split()))
a=list(map(int, input().split()))
a.sort()
d=[a[i+1]-a[i] for i in range(m-1)]
d.sort()
print(sum(d[:m-n]) if m>n else 0)
N,M = map(int,input().split())
H = list(map(int,input().split()))

rlist = {n:[] for n in range(1,N+1)}
cnt = 0
for m in range(1.M+1):
  A,B = map(int,input().split())
  rlist[A].append(B)
  rlist[B].append(A)

for k,v in rlist.items():
  if len(v) == 0:
    cnt += 1
  else:
    for i in v:
      if H[k-1] <= H[i-1]:
        break
    else:
      cnt += 1
      
print(cnt)

### FIXED CODE ###

N,M = map(int,input().split())
H = list(map(int,input().split()))
 
rlist = {n:[] for n in range(1,N+1)}
cnt = 0
for m in range(1,M+1):
  A,B = map(int,input().split())
  rlist[A].append(B)
  rlist[B].append(A)
  
for k,v in rlist.items():
  if len(v) == 0:
    cnt += 1
  else:
    for i in v:
      if H[k-1] <= H[i-1]:
        break
    else:
      cnt += 1
      
print(cnt)
from collections import deque


def solve(string):
    n, q, *abpx = map(int, string.split())
    ab, px = abpx[:2 * n - 2], abpx[2 * n - 2:]
    check = [True] * (n + 1)
    t = {i: [] for i in range(n + 1)}
    c = [0] * (n + 1)
    d = deque([1])
    for a, b in zip(*[iter(ab)] * 2):
        t[a].append(b)
        t[b].append(a)
    for p, x in zip(*[iter(px)] * 2):
        c[p] += x
    while len(d) > 0:
        curr = d.pop()
        check[curr] = False
        next_ = [i for i in t[curr] if check[i]]
        for n_ in next_:
            c[n_] += c[curr]
        d.extend(next_)
    return " ".join([str(_c) for _c in c[1:]])


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n + m)])))


### FIXED CODE ###

from collections import deque


def solve(string):
    n, q, *abpx = map(int, string.split())
    ab, px = abpx[:2 * n - 2], abpx[2 * n - 2:]
    check = [True] * (n + 1)
    t = {i: [] for i in range(n + 1)}
    c = [0] * (n + 1)
    d = deque([1])
    for a, b in zip(*[iter(ab)] * 2):
        t[a].append(b)
        t[b].append(a)
    for p, x in zip(*[iter(px)] * 2):
        c[p] += x
    while len(d) > 0:
        curr = d.pop()
        check[curr] = False
        next_ = [i for i in t[curr] if check[i]]
        for n_ in next_:
            c[n_] += c[curr]
        d.extend(next_)
    return " ".join([str(_c) for _c in c[1:]])


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n + m -1)])))
# -*- coding: utf-8 -*-


def main():
    from math import degrees, atan

    a, b, x = map(int, input().split())
    h = x / (a ** 2)
    y = 2 * h * a / b
    z = 2 * b - 2 * h

    if 2 * h >= b:
        print(90 - degrees(atan(a / z)))
    else:
        print(degrees(atan(b / y)))


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-


def main():
    from math import degrees, atan

    a, b, x = map(int, input().split())
    h = x / (a ** 2)
    y = 2 * h * a / b
    z = 2 * b - 2 * h

    if x == (a ** 2) * b:
        print(0)
    elif 2 * h >= b:
        print(90 - degrees(atan(a / z)))
    else:
        print(degrees(atan(b / y)))


if __name__ == '__main__':
    main()
i1=input().split()

if i[0] > i[1]:
    print('>')
elif i[0] < i[1]:
    print('<')
else:
    print('=')

### FIXED CODE ###

i=input().split()
x=ord(i[0])
y=ord(i[1])
 
if x > y:
    print('>')
elif x < y:
    print('<')
else:
    print('=')
N,W-map(int,input().split())
w=[]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
dp=[[10**22]*(N*(10**3)+1) for i in range(N+1)]
dp[0][0]=0
for i in range(1,N+1):
    for j in range(N*(10**3)+1):
        if j>=v[i]:
            dp[i][j]=min(dp[i-1][j-v[i]]+w[i],dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
for i in range(N*(10**3),-1,-1):
    if dp[N][i]<=W:
        print(i)
        break


### FIXED CODE ###

N,W=map(int,input().split())
taple=[]
for i in range(N):
    w,v=map(int,input().split())
    taple.append((w,v))
dp=[[10**22]*(N*(10**3)+1) for i in range(N+1)]
dp[0][0]=0
for i in range(1,N+1):
    w,v=taple[i-1]
    for j in range(N*(10**3)+1):
        if j>=v:
            dp[i][j]=min(dp[i-1][j-v]+w,dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
for i in range(N*(10**3),-1,-1):
    if dp[N][i]<=W:
        print(i)
        break
l,r,d=map(int(input().split()))
print(r//d-(l-1)//d)

### FIXED CODE ###

l,r,d=map(int,input().split())
print(r//d-(l-1)//d)
s=int(input())
ans=1
for i in range(1,n+1):
  ans=ans%(10**9+7)*n
  
  
print(ans%1000000007)

### FIXED CODE ###

s=int(input())
ans=1
for i in range(1,s+1):
  ans=ans%(10**9+7)*i
  
  
print(ans%(10**9+7))
X,Y=map(int,input().split())
mod=10**9+7
"""2a+b=X "2b+a=Yを満たすabの並び替え"""
###a+b=(X+Y)/3,a-b=X-Y
###a,b>=0 かつ X+Y(mod3)==0
if (X+Y)%3!=0:
    print("0")##immposible
else:
    a=((X+Y)//3+(X-Y))/2
    b=((X+Y)//3-(X-Y))/2
    ###(a+b)combination a!
    a=min(a,b)
    b=max(a,b)
    c=1
    d=1
    if a>0 and b>=0:
        for i in range(a):
            c*=(a+b-i)
            c=c%mod
            d*=(i+1)
            d=d%mod
        print((c*pow(d,mod-2,mod))%mod)
    elif a==0 and b>0:
        for i in range(b):
            c*=(b-i)
            c=c%mod
        print(c)
    else:
        print("0")

### FIXED CODE ###

X,Y=map(int,input().split())
mod=10**9+7
"""2a+b=X 2b+a=Yを満たすabの並び替え"""
###a+b=(X+Y)/3,a-b=X-Y
###a,b>=0 かつ X+Y(mod3)==0
if (X+Y)%3!=0:
    print("0")##immposible
else:
    a=min(((X+Y)//3+(X-Y))//2,((X+Y)//3-(X-Y))//2)
    b=max(((X+Y)//3+(X-Y))//2,((X+Y)//3-(X-Y))//2)
    ###(a+b)combination a
    c=1
    d=1
    if a>0 and b>=0:
        for i in range(a):
            c*=(a+b-i)
            c=c%mod
            d*=(i+1)
            d=d%mod
        print((c*pow(d,mod-2,mod))%mod)
    elif a==0 and b>0:
        print("1")
    else:
        print("0")
from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#x = ip()                              #入力整数1つ
n,k= (int(i) for i in input().split())      #入力整数横2つ
#x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意
a = []
o = []
p = []
for i in range(n):
    c,d = (int(i) for i in input().split())
    o.append([c,d])
    a.append([d,c])
    p.append(d)
a.sort(reverse=True)

cstackd = []
nestackd = []
nestackt =[]
nneed = []
ctset = set()
sum = 0
for i in range(k):
    if a[i][1] in ctset:
        nneed.append(a[i][0])
    else : ctset.add(a[i][1])
    sum+=a[i][0]

ans = pow(len(ctset),2)+sum
for i in range(k,len(a)):
    if a[i][1] not in ctset: #種類がないばあい
        sum -= nneed.pop()
        sum+= a[i][0]
        ctset.add(a[i][1])
        ans = max (pow(len(ctset),2) + sum,ans)


print(ans)


### FIXED CODE ###

from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#x = ip()                              #入力整数1つ
n,k= (int(i) for i in input().split())      #入力整数横2つ
#x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意
a = []
o = []
p = []
for i in range(n):
    c,d = (int(i) for i in input().split())
    o.append([c,d])
    a.append([d,c])
    p.append(d)
a.sort(reverse=True)

cstackd = []
nestackd = []
nestackt =[]
nneed = []
ctset = set()
sum = 0
for i in range(k):
    if a[i][1] in ctset:
        nneed.append(a[i][0])
    else : ctset.add(a[i][1])
    sum+=a[i][0]

ans = pow(len(ctset),2)+sum
for i in range(k,len(a)):
    if len(nneed) == 0: break
    if a[i][1] not in ctset: #種類がないばあい
        sum -= nneed.pop()
        sum+= a[i][0]
        ctset.add(a[i][1])
        ans = max (pow(len(ctset),2) + sum,ans)


print(ans)
N = int(input())
A = list(map(int, input().split())
ans = 1
for i in range[N]:
    ans = ans*A[i]

if ans<= 10**18:
    print(ans)
    exit(0)
else:
    print(-1)

### FIXED CODE ###

import sys  # sys.exit()を使いたいので

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

if 0 in a:
# 0が1つでもあれば0です
    print(0)
else:
# 0がない場合
    cur = 1  # 現在の数値
    for x in a:
        cur *= x
        if cur > 10 ** 18:
        # 10**18を超えたので終了します
            print(-1)
            sys.exit()
    print(cur)  # 10**18以下なので、出力します
import math
n = int(input())
a = list(map(int, input().split()))
if n <= 2:
    print(max(a))
else:
    gcd_left = [a[0]]
    gcd_right = [a[-1]]
    for i in range(1, n):
        gcd_left.append(math.gcd(a[i], gcd_left[-1]))
        gcd_right.append(math.gcd(a[n-i-1], gcd_right[-1]))
    gcd_right = gcd_right[::-1]
    print(gcd_left, gcd_right)
    ans = max(gcd_left[-2], gcd_right[1])
    for i in range(n-2):
        ans = max(ans, math.gcd(gcd_right[i+2], gcd_left[i]))
    print(ans)

### FIXED CODE ###

import fractions
n = int(input())
a = list(map(int, input().split()))
if n <= 2:
    print(max(a))
else:
    gcd_left = [a[0]]
    gcd_right = [a[-1]]
    for i in range(1, n):
        gcd_left.append(fractions.gcd(a[i], gcd_left[-1]))
        gcd_right.append(fractions.gcd(a[n-i-1], gcd_right[-1]))
    gcd_right = gcd_right[::-1]
    # print(gcd_left, gcd_right)
    ans = max(gcd_left[-2], gcd_right[1])
    for i in range(n-2):
        ans = max(ans, fractions.gcd(gcd_right[i+2], gcd_left[i]))
    print(ans)
N=int(input())
a=list(map(int,input().split()))
m=max(a)
mm=min(a)
p=[0]*(m-mm)

if 1<=len(a)<=3:
  print(len(a))
else:
  for i in range(mm,m-1):
    p[i]=a.count(i)+a.count(i+1)+a.count(i+2)
  print(max(p))

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
M=max(a)
m=min(a)
x=[0]*(M-m+3)
for i in a:
  x[i-m]+=1
  x[i-m+1]+=1
  x[i-m+2]+=1
print(max(x))
#import math
#import sys
#import bisect
#input = sys.stdin.readline
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return((a*b)//gcd(a,b))

def main():
    #x,y = map(int,input().split())	x=1,y=2
    #a = input().split()	a=['1','2','3',...,'n']
    #a = list(map(int,input().split()))	a=[1,2,3,4,5,...,n]
    #li = input().split('T')	FFFTFTTFF => li=['FFF', 'F', '', 'FF']
    n=int(input())
    a = list(map(int,input().split()))
    b=a.copy()
    for i in range(n):
        x=b[i]
        a.sort()
        if x<=a[(n//2)-1]:
            print(a[(n//2)])
        else:
            print(a[(n//2)-1])

main()

### FIXED CODE ###

import math
import copy
#import sys
#import bisect
#input = sys.stdin.readline
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return((a*b)//gcd(a,b))

def main():
    #x,y = map(int,input().split())	x=1,y=2
    #a = input().split()	a=['1','2','3',...,'n']
    #a = list(map(int,input().split()))	a=[1,2,3,4,5,...,n]
    #li = input().split('T')	FFFTFTTFF => li=['FFF', 'F', '', 'FF']
    n=int(input())
    a = list(map(int,input().split()))
    b=copy.copy(a)
    a.sort()
    for i in range(n):
        x=b[i]
        if x<=a[(n//2)-1]:
            print(a[(n//2)])
        else:
            print(a[(n//2)-1])

main()
ef main():
    N = int(input())
    jobs = [list(map(int, input().split())) for _ in range(N)]
    time = 0
    jobs = sorted(jobs, key=lambda x: x[1])
    for j in jobs:
        time += j[0]
        if time > j[1]:
            print("No")
            return
        
    else:
        print("Yes")


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N = int(input())
    jobs = []
    time = 0
    for _ in range(N):
        A, B = map(int, input().split())
        jobs.append((A, B))

    jobs = sorted(jobs, key=lambda x: x[1])
    for j in jobs:
        time += j[0]
        if time > j[1]:
            print("No")
            return
        
    else:
        print("Yes")


if __name__ == '__main__':
    main()
a = raw_input()
print(a)

### FIXED CODE ###

a = int(input())


hs = [int(x) for x in input().split()]

if a == 1:
  print(0)
  exit()
dp = [0]* len(hs)


dp[0] = 0
dp[1] = abs(hs[1] - hs[0])

for i in range(2, a):
  dp[i] = min(abs(hs[i-1]- hs[i]) + dp[i-1], abs(hs[i-2]- hs[i]) + dp[i-2] )
  
print(dp[-1])
def coins(a,b,c,x):
    num=0
    for i in range(a):
        for w in range(b):
            for q in range(c):
                if 500*i + 100*w + 50*q == x:
                    num += 1
    return num
  
def main():
  a,b,c,x=input()
  print(coins(a,b,c,x))
 
if __name__ == '__main__':
    main()

### FIXED CODE ###

def coins(a,b,c,x):
    num=0
    for i in range(a+1):
        for w in range(b+1):
            for q in range(c+1):
                if 500*i + 100*w + 50*q == x:
                    num += 1
    return num
  
def main():
  a=int(input())
  b=int(input())
  c=int(input())
  x=int(input())
  print(coins(a,b,c,x))
 
if __name__ == '__main__':
    main()
n, k = map(int,input(),split())
print(n[k].lower())

### FIXED CODE ###

n, k = map(int,input().split())
s = list(input())
s[k-1] = s[k-1].lower()
print("".join(s))
from collections import deque
n,m=map(int,input().split())
A=[[0]*2 for i in range(n)]
for i in range(m):
  A[i]=list(map(int,input().split()))
ans=0
for i in range(m):
  B=[[] for i in range(n)]
  for j in range(m):
    if j==i:
      continue
    B[A[j][0]-1].append(A[j][1]-1)
    B[A[j][1]-1].append(A[j][0]-1)
  C=[0]*n
  C[0]=1
  D=deque([0])
  while len(D)>0:
    x=D[0]
    D.popleft()
    for j in range(len(B[x])):
      if C[B[x][j]]==0:
        D.append(B[x][j])
        C[B[x][j]]=1
  if C!=[1]*n:
    ans=ans+1
print(ans)

### FIXED CODE ###

from collections import deque
n,m=map(int,input().split())
A=[[0]*2 for i in range(m)]
for i in range(m):
  A[i]=list(map(int,input().split()))
ans=0
for i in range(m):
  B=[[] for i in range(n)]
  for j in range(m):
    if j==i:
      continue
    B[A[j][0]-1].append(A[j][1]-1)
    B[A[j][1]-1].append(A[j][0]-1)
  C=[0]*n
  C[0]=1
  D=deque([0])
  while len(D)>0:
    x=D[0]
    D.popleft()
    for j in range(len(B[x])):
      if C[B[x][j]]==0:
        D.append(B[x][j])
        C[B[x][j]]=1
  if C!=[1]*n:
    ans=ans+1
print(ans)
from math import factorial
C = lambda y, x: factorial(y) // factorial(x) // factorial(y - x)
mod = 1000000007
def solve():
    n, k = map(int, input().split())
    for i in range(1, k + 1):
        print(C(n - k + 1, i) * C(k - 1, i - 1) % mod)
solve()


### FIXED CODE ###

from math import factorial
C = lambda y, x: factorial(y) // factorial(x) // factorial(y - x)
mod = 1000000007
def solve():
    n, k = map(int, input().split())
    for i in range(1, k + 1):
        if i <= (n - k) + 1:
            print(C(n - k + 1, i) * C(k - 1, i - 1) % mod)
        else:
            print(0)
solve()
S = input().strip()
K = int(input())
A = []
cur = 0
for i in range(1,len(S)):
    if S[i]!=S[i-1]:
        if i-cur>=2:
            A.append([S[i-1],cur,i])
        cur = i
if S[-1]==S[-2]:
    A.append([S[-1],cur,len(S)])
cnt = 0
for j in range(len(A)):
    cnt += (A[j][2]-A[j][1])//2
if S[0]!=S[-1]:
    cnt = cnt*K
else:
    if S[0]!=S[1] and S[-1]!=S[-2]:
        cnt = cnt+(cnt+1)*(K-1)
    elif S[0]==S[1] and S[-1]!=S[-2]:
        if (A[0][2]-A[0][1])%2==0:
            cnt = cnt*K
        else:
            cnt = cnt+(cnt+1)*(K-1)
    elif S[0]!=S[1] and S[-1]==S[-2]:
        if (A[-1][2]-A[-1][1])%2==0:
            cnt = cnt*K
        else:
            cnt = cnt+(cnt+1)*(K-1)
    elif S[0]==S[1] and S[-1]==S[-2]:
        if (A[0][2]-A[0][1])%2==0 or (A[-1][2]-A[-1][1])%2==0:
            cnt = cnt*K
        else:
            cnt = cnt+(cnt+1)*(K-1)
print(cnt)

### FIXED CODE ###

S = input().strip()
K = int(input())
if len(S)==1:
    cnt = K//2
else:
    A = []
    cur = 0
    for i in range(1,len(S)):
        if S[i]!=S[i-1]:
            if i-cur>=2:
                A.append([S[i-1],cur,i])
            cur = i
    if S[-1]==S[-2]:
        A.append([S[-1],cur,len(S)])
    cnt = 0
    for j in range(len(A)):
        cnt += (A[j][2]-A[j][1])//2
    if S[0]!=S[-1]:
        cnt = cnt*K
    else:
        if S[0]!=S[1] and S[-1]!=S[-2]:
            cnt = cnt+(cnt+1)*(K-1)
        elif S[0]==S[1] and S[-1]!=S[-2]:
            if (A[0][2]-A[0][1])%2==0:
                cnt = cnt*K
            else:
                cnt = cnt+(cnt+1)*(K-1)
        elif S[0]!=S[1] and S[-1]==S[-2]:
            if (A[-1][2]-A[-1][1])%2==0:
                cnt = cnt*K
            else:
                cnt = cnt+(cnt+1)*(K-1)
        elif S[0]==S[1] and S[-1]==S[-2] and len(A)>1:
            if (A[0][2]-A[0][1])%2==0 or (A[-1][2]-A[-1][1])%2==0:
                cnt = cnt*K
            else:
                cnt = cnt+(cnt+1)*(K-1)
        else:
            cnt = (len(S)*K)//2
print(cnt)