Harryxun/stf_run huggingface dataset:
if __name__ == "__main__":
    N, M = map(int, input().split())
    city_list = []
    for i in range(M):
        city_list.append(list(map(int, input().split())))
    pref = {}
    pref_sort = {}
    for i in range(M):
        key = city_list[i][0]
        val = city_list[i][1]
        if str(key) in pref:
            pref[str(key)].append(val)
        else:
            pref[str(key)] = [val]
    ans = {}
    for i in range(N):
        pref[str(i+1)].sort()
    for i in range(M):
        key = city_list[i][0]
        val = city_list[i][1]
        output = str(key).zfill(6) + str(pref[str(key)].index(val)+1).zfill(6)
        print(output)

### FIXED CODE ###

# AtCoder Beginner Contest 113-C
if __name__ == "__main__":
    N, M = map(int, input().split())
    city_list = []
    for i in range(M):
        city_list.append(list(map(int, input().split())))
    pref = {}
    pref_sort = {}
    for i in range(M):
        key = city_list[i][0]
        val = city_list[i][1]
        if str(key) in pref:
            pref[str(key)].append(val)
        else:
            pref[str(key)] = [val]
    ans = {}
    for key, val in pref.items():
        val.sort()
        for i in range(len(val)):
            ans[(key, val[i])] = str(key).zfill(6) + str(i+1).zfill(6)
    for key, val in city_list:
        print(ans[str(key), val])
r1, c1, r2, c2 = map(int, input().split())

MOD=10**9+7
MAXN=400000+10
g1=[1, 1]
g2=[1, 1]
inverse=[0, 1]

for i in range(2, MAXN+1): 
    g1.append((g1[-1]*i)%MOD)
    inverse.append(-inverse[MOD%i]*(MOD//i)%MOD)
    g2.append((g2[-1]*inverse[-1])%MOD)

def comb(n, r): 
    if r<0 or r>n: 
        return 0
    r=min(r, n-r)
    return g1[n]*g2[r]*g2[n-r]%MOD

ans = comb(r2+c2+2, r2+1)-1
ans -= comb(r2+1+c1, c1)-1
ans -= comb(r1+c2+1, r1)-1
ans += comb(r1+c1, r1)-1

print(ans%MOD)

### FIXED CODE ###

def comb(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    return g1[n]*g2[r]*g2[n-r]%MOD

MOD=10**9+7
MAXN=2000000+10
g1=[1, 1]
g2=[1, 1]
inverse=[0, 1]

for i in range(2, MAXN+1):
    g1.append((g1[-1]*i)%MOD)
    inverse.append(-inverse[MOD%i]*(MOD//i)%MOD)
    g2.append((g2[-1]*inverse[-1])%MOD)

r1, c1, r2, c2=map(int, input().split())
s1=comb(r2+c2+2, r2+1)-1
s2=comb(r1+c2+1, r1)-1
s3=comb(r2+c1+1, r2+1)-1
s4=comb(r1+c1, r1)-1
print((s1-s2-s3+s4)%MOD)
MOD=10**9+7
n,k=map(int,input().split())
a=list(map(int,input().split()))

a.sort(reverse=True)


from scipy.misc import comb
c=[]
for i in range(1,k):
  c.append(comb(n-i,k-1,exact=True)%MOD)
lc=len(c)
sum=0
for i in range(lc):
  sum+=c[i]*(a[i]-a[-i-1])%MOD
  
print(sum%MOD)


### FIXED CODE ###

MOD=10**9+7
n,k=map(int,input().split())
a=list(map(int,input().split()))

a.sort(reverse=True)


fact = [1]
fact_inv = [1]
mod=10**9+7
for i in range(10**5+1):
    new_fact = fact[-1]*(i+1)%mod
    fact.append(new_fact)
    fact_inv.append(pow(new_fact,mod-2,mod))


def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod

  
c=[]
for i in range(1,n-k+1+1):
  c.append(mod_comb_k(n-i,k-1,MOD))
lc=len(c)
#print(c,a)
sum=0
for i in range(lc):
  sum+=c[i]*(a[i]-a[-i-1])%MOD
  
print(sum%MOD)
import sys
sys.setrecursionlimit(1000000)
 
N = int(input())
h = list(map(int,input().split()))
 
N -= 1
 
def step(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(h[1]-h[0])
  elif step[i-1]+abs(h[i-1]-h[i]) <= step[i-2]+abs(h[i-2]-h[i]):
    return step(i-1) + abs(h[i-1]-h[i])
  else:
    return step(i-2) + abs(h[i-2]-h[i])
  
print(step(N))

### FIXED CODE ###

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

dp = [0]*N

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

for i in range(2,N):
  dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))

print(dp[N-1])
l,r = map(int, input().split())
if r-l+1>2019:
  print(0)
  exit()
L = []
for i in range(l,r):
  for j in range(i+1,r):
    a = i*j
    b = a%2019
    L.append(b)
print(min(L))


### FIXED CODE ###

a,b,c = map(int,input().split())
train =a*b
if train > c:
  print(c)
else:
  print(train)
from scipy.misc import comb
# a = comb(n, r)
# a = comb(n, r, exact=True)

n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
a = []
a.append(l[0])
cnt = 1
numMap = {}

for i in range(1, n):
    if l[i] == l[i-1]:
        cnt += 1
    else:
        if cnt > 2:
            numMap[l[i-1]] = cnt
        a.append(l[i])
        cnt = 1

numMap[l[-1]] = cnt

for i, val in numMap.items():
    #print(i, val)
    temp = comb(val, 3, exact=True)
    ans += temp

# print(a)
# print(numMap)
# print(ans)

for i in range(len(a)):
    for j in range(i+1, len(a)):
        length = a[i] + a[j]

        for k in range(j+1, len(a)):
            if a[k] >= length:
                break
            else:
                ans += numMap[a[i]] * numMap[a[j]] * numMap[a[k]]

print(ans)


### FIXED CODE ###

import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
biSet = set()


for i in range(n):
    for j in range(i+1, n):
        length = l[i] + l[j]

        index = bisect.bisect_left(l[j+1:], length)
        #print(index)
        if index > 0:
            ans += index


print(ans)
import math
def pcount(n, r):
    return math.factorial(n) // (math.factorial(r)* math.factorial(n - r))

n, a, b = map(int, input().split())
L = [int(i) for i in input().split()]
L.sort(reverse=True)

T = L[:a]
print(sum(T)/a)

s = 0
Tmin = min(T)
countTminT = T.count(Tmin)
countTminL = L.count(Tmin)

if a == 1 and countTminL == 1:
  s = 1
elif countTminT == a:
  for i in range(a,b+1):
    s += pcount(countTminL, i)
else:
  s += pcount(countTminL, countTminT)

print(s)

### FIXED CODE ###

import math
def pcount(n, r):
    return math.factorial(n) // (math.factorial(r)* math.factorial(n - r))

n, a, b = map(int, input().split())
L = [int(i) for i in input().split()]
L.sort(reverse=True)

T = L[:a]
print(sum(T)/a)

s = 0
Tmin = min(T)
countTminT = T.count(Tmin)
countTminL = L.count(Tmin)

if a == 1 and countTminL == 1:
  s = 1
elif countTminT == a:
  for i in range(a,b+1):
    if countTminL+1 == i:
      break
    s += pcount(countTminL, i)
else:
  s += pcount(countTminL, countTminT)

print(s)
a=0
b=0
list = input()
a = int(list[0])
b = int(list[2])
print(a*b,2*(a+b))

### FIXED CODE ###

ab = input()
num_ab = ab.split()
a = int(num_ab[0])
b = int(num_ab[1])
print(a*b,2*(a+b))
import sys
sys.setrecursionlimit(10**7)
N, K = map(int, input().split())

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

col = [-1 for i in range(N)]
col[0] = 0
MOD = 10 ** 9 + 7


def dfs(i, ans, depth):
    if depth == 1:
        num = K - 1
    else:
        num = K - 2
    for v in e[i]:
        if col[v] == -1:
            col[v] = 0
            ans = (ans * num) % MOD
            num -= 1
            ans = dfs(v, ans, depth+1)

    return ans


print(dfs(0, K, 1))


### FIXED CODE ###

n,a,b=map(int,input().split())
print(min(b,n*a))
N, K = map(int, input().split())
*A, = map(int, input().split())
d = [0]*(N+1)
for a in A:
    d[a] += 1
    d.sort()
    d.reverse()
    print(sum(d[K:]))


### FIXED CODE ###

i = input()
a = i.count('1')

print(a)
n,l=map(int,input().split())
s=[0]*n
res=''
for i in range(n):
  s.append(input())
s.sort()
for k in range(n):
  res+=s[k]
print(res)

### FIXED CODE ###

n,l=map(int,input().split())
s=[]
t=''
for i in range(n):
  s.append(input())
s.sort()
for k in s:
  t+=k
print(t)
N, M = map(int, input().split())

count = [0] * (N)
E = [[] for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    E[a - 1].append(b - 1)
    E[b - 1].append(a - 1)
    count[a - 1] += 1
    count[b - 1] += 1

count_sum = 0
count4 = 0
count6 = 0
node = 0

check = [False] * N

for i, temp in enumerate(count):
    if temp % 2 == 1:
        print("No")
        exit()
    else:
        if temp >= 4:
            count4 += 1
            check[i] = True
            node = i
        if temp >= 6:
            count6 += 1
        count_sum += temp

def dfs(v, first, depth):
    global E, check

    ret = 0
    for next_v in E[v]:
        if depth >= 2 and next_v == first:
            return 1
        elif not check[next_v]:
            check[next_v] = True
            ret += dfs(next_v, first, depth + 1)

    return ret

if count4 >= 3 or count6 >= 1:
    print("Yes")
elif count4 == 2:
    ret = dfs(node, node, 0)
    if ret > 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
    


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

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

count = [0] * (N)
E = [[] for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    E[a - 1].append(b - 1)
    E[b - 1].append(a - 1)
    count[a - 1] += 1
    count[b - 1] += 1

count_sum = 0
count4 = 0
count6 = 0
node = 0

check = [False] * N

for i, temp in enumerate(count):
    if temp % 2 == 1:
        print("No")
        exit()
    else:
        if temp >= 4:
            count4 += 1
            check[i] = True
            node = i
        if temp >= 6:
            count6 += 1
        count_sum += temp

def dfs(v, first, depth):
    global E, check

    ret = 0
    for next_v in E[v]:
        if depth >= 2 and next_v == first:
            return 1
        elif not check[next_v]:
            check[next_v] = True
            ret += dfs(next_v, first, depth + 1)

    return ret

if count4 >= 3 or count6 >= 1:
    print("Yes")
elif count4 == 2:
    ret = dfs(node, node, 0)
    if ret > 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
n = int(input())
s = [int(input()) for i range(n)]
summ = sum(s)
ans = [0]*summ
for i in range(n):
  ans[i] -= 

### FIXED CODE ###

N = int(input())
s = [int(input()) for i in range(N)]
s_shadow = [i for i in s if i % 10 != 0]
ans = sum(s)

if ans % 10 == 0:
    if len(s_shadow) == 0:
        ans = 0
    
    else:
        s_can = sorted([ans-i for i in s_shadow])
        ans = s_can[-1]
print(ans)
n = int(input())
t = {i:{} for i in range(n)}
ans = [-1]*n
for _ in range(n-1):
    u, v, w = map(int, input().split())
    t[u-1][v-1] = w
    t[v-1][u-1] = w

def dfs(x):
    for y in t[x]:
        del t[y][x]
        ans[y] = ans[x] if t[x][y] % 2 == 0 else 1-ans[x]
        if len(t[y]) > 0:
            dfs(y)

ans[0] = 0
dfs(0)
for i in range(n):
    print(ans[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)

n = int(input())
t = {i:{} for i in range(n)}
ans = [-1]*n
for _ in range(n-1):
    u, v, w = map(int, input().split())
    t[u-1][v-1] = w
    t[v-1][u-1] = w

def dfs(x):
    for y in t[x]:
        del t[y][x]
        ans[y] = ans[x] if t[x][y] % 2 == 0 else 1-ans[x]
        if len(t[y]) > 0:
            dfs(y)

ans[0] = 0
dfs(0)
for i in range(n):
    print(ans[i])
print(eval(input()))

### FIXED CODE ###

print(eval(str(input())))
a,p=map(int,input().split())
print((3*a+p)//2))

### FIXED CODE ###

a,p=map(int,input().split())
print((3*a+p)//2)
a,b = map(int, input().split())

a+b=k

a%3=m

b%3=n

k%3=r

if m==0 or n==0 or r==0:
  print("Possible")
else:
  print("Impossible")

### FIXED CODE ###

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

if (a+b)%3==0 or a%3==0 or b%3==0: 
  print("Possible")
else:
  print("Impossible")
s=input()
ans=0
for i in len(s):
    if s[i]=="2": ans+=1
print(ans)

### FIXED CODE ###

s=input()
ans=0
for i in range(len(s)):
    if s[i]=="2": ans+=1
print(ans)
import heapq
n,m=map(int,input().split())
x=sorted(list(map(int,input().split())))
diff=[]
heapq.heapify(diff)
if n>=m:
    print(0)
else:
    for i in range(m-1):
        heapq.heappush(diff,x[i]-x[i+1]-1)
    temp=0
    for _ in range(n-1):
        temp-=heapq.heappop(diff)
        #print(-heapq.heappop(diff))
print(x[m-1]-x[0]+1-temp)

### FIXED CODE ###

import heapq
n,m=map(int,input().split())
x=sorted(list(map(int,input().split())))
diff=[]
heapq.heapify(diff)
if n>=m:
    print(0)
else:
    for i in range(m-1):
        heapq.heappush(diff,x[i]-x[i+1]+1)
    temp=0
    for _ in range(n-1):
        temp-=heapq.heappop(diff)
    print(x[m-1]-x[0]+1-temp-n)
import math
r = int(input())
pi = math.pi
print ("%f %f" % (r*r*pi, 2*r*pi))

### FIXED CODE ###

import math
r = float(input())
pi = math.pi
print ("%f %f" % (r*r*pi, 2*r*pi))
s = input()
k = int(input())
def unit(s):
    """sの両端を外した状態でいくつ変えるか
    """
    count = 0
    prev = s[0]
    for c in s[1:]:
        if c==prev:
            count += 1
            prev = None
        else:
            prev = c
    return count
if len(s)==2:
    if s[0]==s[1]:
        print(k)
    else:
        print(0)
elif k==1:
    print(unit(s))
elif len(s)==1:
    print(k//2)
elif not s:
    print(0)
elif s[0]!=s[-1]:
    print(k * unit(s))
#     if k==1:
#         print(unit(s))
#     else:
#         result = s2 + s0 * (k-2) + s1
#         print(result)
else:
    s0 = unit(s[1:-1])
    s1 = unit(s[1:])
    s2 = unit(s[:-1])
    s3 = unit(s)
    import numpy as np
    a = np.zeros((k+1,2), dtype=int)
    a[1,0] = s3
    a[1,1] = s1
    for n in range(2,k+1):
        a[n, 0] = min(a[n-1,1]+s3, a[n-1,0]+s2) + 1
        a[n, 1] = min(a[n-1,1]+s0, a[n-1,0]+s1) + 1
    print(a[k,0])
#     result = min(s1*(k-1)+s3, s2*(k-1)+s3)
#     if k%2==0:
#         result2 = min(s3*(k/2)+s0*(k/2-1)+s1, s2+s3*(k/2)+s0*(k/2-1))
#     else:
#         result2 = min(s3*(k//2+1)+s0*(k//2), s2+(s3*(k//2)+s0*(k//2-1))+s1)
#     print(min(result, result) + (k-1))

### FIXED CODE ###

# AGC039A

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))


s = input()
k = int(input())

def sub(s):
    if not s:
        return 0
    # 連続する文字のカウント
    prev = s[0]
    counts = []
    count = 1
    for c in s[1:]:
        if c==prev:
            count += 1
        else:
            counts.append(count)
            count = 1
        prev = c
    if count>=2:
        counts.append(count)
    return sum([item//2 for item in counts])

if s[0]!=s[-1]:
    ans = k * sub(s)
elif all(s[0]==s[i] for i in range(1, len(s))):
    ans = (k * len(s)) // 2
else:
    i = 0
    while s[i]==s[-1]:
        i += 1
    ss = s[i:] + s[:i]
    ans = sub(s[:i]) + (k-1)*sub(ss) + sub(s[i:])
print(ans)
#     s1 = s[:-1] + "A"
#     c1 = sub(s1)
#     s2 = "B" + s[1:]
#     c2 = sub(s2)
t = input()
if(t[0] == '?'):
    if(t[1] == 'D'):  t = "".join(['P' , t[1:]])
    elif(t[1] == '?'): t = "".join(['PD', t[2:]])
    else: t = "".join(['D', t[1:]])
if(t[len(t) -1] == '?'):
    t = "".join([t[:len(t) - 1], 'D'])
for i in range(len(t)):
    if(t[i] == '?'):
        if(t[i-1] == 'P'):    t = "".join([t[:i], 'D' , t[i+1:]])
        elif(t[i+1] == 'D'):  t = "".join([t[:i], 'P' , t[i+1:]])
        elif(t[i+1] == 'P'):  t = "".join([t[:i], 'D' , t[i+1:]])
        elif(t[i+1] == '?'):  t = "".join([t[:i], 'PD', t[i+2:]])
print(t)
~             

### FIXED CODE ###

t = input()
if(len(t) == 1):
    if (t[0] == '?'): t = "D"
if(t[0] == '?'):
    if  (t[1] == 'D'): t = "".join(['P' , t[1:]])
    elif(t[1] == '?'): t = "".join(['PD', t[2:]])
    else:              t = "".join(['D' , t[1:]])
if(t[-1] == '?'):
    t = "".join([t[:-1], 'D'])
for i in range(len(t)-1):
    if(t[i] == '?'):
        if(t[i-1] == 'P'):    t = "".join([t[:i], 'D' , t[i+1:]])
        elif(t[i+1] == 'D'):  t = "".join([t[:i], 'P' , t[i+1:]])
        elif(t[i+1] == 'P'):  t = "".join([t[:i], 'D' , t[i+1:]])
        elif(t[i+1] == '?'):  t = "".join([t[:i], 'PD', t[i+2:]])
print(t)
#Rating Goal
R, G = map(int, input().split())
T = R + 2 * (G - R)
print(T)

### FIXED CODE ###

#Rating Goal
R = int(input())
G = int(input())
T = R + 2 * (G - R)
print(T)
K,A,B=map(int,input().split())
if A>=K:
  print(1)
elif A<B:
  print(-1)
else:
  bef=((K-A)//(A-B))+((K-A)%(A-B)!=0)
  print(2*bef+1)


### FIXED CODE ###

K,A,B=map(int,input().split())
if A>=K:
  print(1)
elif A<=B:
  print(-1)
else:
  bef=((K-A)//(A-B))+((K-A)%(A-B)!=0)
  print(2*bef+1)
import sys

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

gap = [abs(a-e),abs(b-e),abs(c-e),abs(d-e)]

for i in range(len(gap)):
	if gap[i] > k:
		print(':(')
		sys.exit()
print('Yay!')

### FIXED CODE ###

A,B = map(int,input().split())
target = list(range(1,A+1))
target.extend(list(range(1,B+1)))

target.sort(reverse=True)
print(target[0]+target[1])
H,N = map(int,input().split())
Damage = []
Cost = []


DP = [0] + [pow(10,9)] * (H+1)



for i in range(N):
    a,b = map(int,input().split())
    Damage.append(a)
    Cost.append(b)
    
#print(DP)

damage = np.array(Damage)
cost = np.array(Cost)
dp = np.array(DP)




# DP[i] = best magic points to do i damage

for i in range(1,len(dp)):
    for spell in range(N):
        dp[i] = min(dp[i],dp[max(0,i-damage[spell])]+cost[spell])




print (dp[H])




### FIXED CODE ###


     

import math



H,N = map(int,input().split())
Damage = []
Cost = []


DP = [0] + [pow(10,9)] * (H+1)



for i in range(N):
    a,b = map(int,input().split())
    Damage.append(a)
    Cost.append(b)
    
#print(DP)


# DP[i] = min magic points to do i damage

for i in range(1,len(DP)):
    for spell in range(N):
        DP[i] = min(DP[i],DP[max(0,i-Damage[spell])]+Cost[spell])




print (DP[H])
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
    return (a * b) // gcd(a,  b)

def lcm_list(li):
    if len(li) == 1:
        return li[0]

    elif len(li) == 2:
        return lcm(li[0], li[1])
        
    else:
        li = [lcm(li[0], li[1])] + li[2:]
        return  lcm_list(li)

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


i = lcm_list(a) -1
print(sum([i%j for j in a]))


### FIXED CODE ###

import sys
sys.setrecursionlimit(30000)

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

def lcm_list(li):
    if len(li) == 2:
        return lcm(li[0], li[1])

    else:
        li = [lcm(li[0], li[1])] + li[2:]
        return lcm_list(li)

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


i = max(lcm_list(a) - 1, 1)
print(sum([i % j for j in a]))
# -*- coding:utf-8 -*-
import sys
def dfs(x, y, sym):
	tile[x][y] = "."
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if (0<=nx and nx<N and 0<=ny and ny<M and tile[nx][ny] is sym):
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			sym = tile[i][j]
			if tile[i][j] != ".":
				if tile[i][j] is sym:
					dfs(i, j, sym)
					res += 1
	print(res)

counter=0
flg=1
DX = [-1, 0, 1, 0]
DY = [0, -1, 0, 1]
sys.setrecursionlimit(10**7)
while True:
	line = input()
	counter += 1
	if flg is 1:
		nums = line.split(" ")
		N = int(nums[0])
		M = int(nums[1])
		tile = [[0 for i in range(N)] for j in range(M)]
		flg=0
	else:
		tile[counter-2] = list(line)
	if N is 0 and M is 0:
		break
	if counter-1 is M:
		solve()
		flg = 1
		counter = 0

### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys
def dfs(x, y, sym):
	tile[x][y] = "."
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if (0<=nx and nx<N and 0<=ny and ny<M and tile[nx][ny] is sym):
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			sym = tile[i][j]
			if tile[i][j] != ".":
				if tile[i][j] is sym:
					dfs(i, j, sym)
					res += 1
	print(res)

counter=0
DX = [-1,0,1,0]
DY = [0,-1,0,1]
sys.setrecursionlimit(10**7)
while True:
	line = input()
	if " " in line:
		nums = line.split(" ")
		N = int(nums[0])
		M = int(nums[1])
		tile = [[0 for i in range(M)] for j in range(N)]
	else:
		tile[counter-1] = list(line)
	if N is 0 and M is 0:
		break
	counter += 1
	if counter-1 is N:
		solve()
		counter = 0
import math
a = int(input())
print(2*math.py:a)






### FIXED CODE ###

import math
a = int(input())
print(2*math.pi*a)
from collections import deque

h, w = map(int, input().split())

maze = [input() for i in range(h)]

ans = 0
INF = 20 * 20 + 1
for j in range(h):
    for i in range(w):
        if maze[j][i] == ".":
            cnt = [[INF] * w for _ in range(h)] 
            cnt[j][i] = 0
            q = deque([(j,i)])
            while q:
                y,x = q.popleft()
                for by,bx in ((0,1),(0,-1),(1,0),(-1,0)):
                    by += y
                    bx += x 
                    if 0 <= by < h and 0 <= bx < w:
                        ct = cnt[y][x] + 1
                        if maze[ny][nx] == "." and ct < cnt[ny][nx]:
                            q += [(by,bx)] 
                            cnt[by][bx] = ct
                            ans = max(ans, cnt[by][bx])

print(ans)

### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())

maze = [input() for i in range(h)]

ans = 0
for j in range(h):
    for i in range(w):
        if maze[j][i] == ".":
            cnt = [[0] * w for _ in range(h)] 
            q = deque([(j,i)])
            while q:
                y,x = q.popleft()
                for by,bx in ((0,1),(0,-1),(1,0),(-1,0)):
                    ny = y + by
                    nx = x + bx
                    if 0 <= ny < h and 0 <= nx < w:
                        if maze[ny][nx] == "." and cnt[ny][nx] == 0:
                            q += [(ny,nx)]
                            cnt[ny][nx] += cnt[y][x] + 1
                            ans = max(ans, cnt[ny][nx])
                if y == j and x == i:
                    cnt[y][x] = -1


print(ans)
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

def test(x):
  return x % 2 == 1 and sum(x % y == 0 for y in range(1, x+1)) == 8

S = input()
K = read() - 1
i0 = next(i for i in range(len(S)) if S[i] != '1')
if K < i0:
  print(1)
else:
  print(S[i0])


### FIXED CODE ###

from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

def test(x):
  return x % 2 == 1 and sum(x % y == 0 for y in range(1, x+1)) == 8

S = input()
K = read() - 1
N = len(S)
i0 = next((i for i in range(N) if S[i] != '1'), N)
if K < i0:
  print(1)
else:
  print(S[i0])
INF = float("inf")
IINF = 10 ** 18
MOD = 998244353


def main():
    M = int(input())
    digits = []
    S = 0

    for i in range(M):
        d, c = list(map(int, input().split()))

        if d == 0 and i == 0:
            continue

        for i in range(c):
            digits.append(d)
            S += d

    print((len(d) - 1) + (S - 1) // 9)


if __name__ == '__main__':
    main()


### FIXED CODE ###

INF = float("inf")
IINF = 10 ** 18
MOD = 998244353


def main():
    M = int(input())
    N = 0
    S = 0

    for i in range(M):
        d, c = list(map(int, input().split()))

        if d == 0 and i == 0:
            continue

        S += d * c
        N += c

    print((N - 1) + (S - 1) // 9)


if __name__ == '__main__':
    main()
"""
B - AcCepted
文字列 S が与えられます。S のそれぞれの文字は英大文字または英小文字です。 S
が次の条件すべてを満たすか判定してください。

S の先頭の文字は大文字の A である。
Sの先頭から 3 文字目と末尾から 2 文字目の間（両端含む）に大文字の C がちょうど 1
個含まれる。
以上の A, C を除く S のすべての文字は小文字である。
"""

s = input()

ans = True
if s[0] != "A":
    ans = False
    #print("s[0] is not A")
else:
    cnt_C = 0
    for n in range(1, len(s)):
        check_char = s[n]
        
        if check_char.islower():
            pass
        else:
            if check_char == "C" and 2 <= n and n < (len(s) - 1):
                cnt_C += 1
            else:
                ans = False
                break

if cnt_C != 1:
    ans = False

if ans:
    print("AC")
else:
    print("WA")

### FIXED CODE ###

"""
B - AcCepted
文字列 S が与えられます。S のそれぞれの文字は英大文字または英小文字です。 S
が次の条件すべてを満たすか判定してください。

S の先頭の文字は大文字の A である。
Sの先頭から 3 文字目と末尾から 2 文字目の間（両端含む）に大文字の C がちょうど 1
個含まれる。
以上の A, C を除く S のすべての文字は小文字である。
"""

s = input()

cnt_C = 0
ans = True
if s[0] != "A":
    ans = False
    #print("s[0] is not A")
else:
    length = len(s)

    n = 1
    for check_char in s[1:]:
        #print(check_char)
        
        if check_char.islower() is False:
            if check_char != "C" or n == 1 or n == (length - 1):
                ans = False
            
            cnt_C += 1
        
        n += 1

if cnt_C != 1:
    ans = False

if ans:
    print("AC")
else:
    print("WA")