n,s = map(str,input().split(" "))

if s=="km":
    print(int(n)*1000000)
elif s=="m":
    print(int(n)*1000)
else:
    print(int(n)*10)

af154728bd515ec99a95eaccb6c8f24f5d068a0c
<mask token>

<mask token>
if s == 'km':
    print(int(n) * 1000000)
elif s == 'm':
    print(int(n) * 1000)
else:
    print(int(n) * 10)

n, s = map(str, input().split(' '))
if s == 'km':
    print(int(n) * 1000000)
elif s == 'm':
    print(int(n) * 1000)
else:
    print(int(n) * 10)

n,s = map(str,input().split(" "))

if s=="km":
    print(int(n)*1000000)
elif s=="m":
    print(int(n)*1000)
else:
    print(int(n)*10)
