Harryxun/stf_run huggingface dataset:
Hlong = int(input())
    Mlong= int(input())
    h = int(input()) * 30
    m = int(input()) * 6
    degree = abs(h - m)
    if degree > 180:
        degree = 360 - degree
    print(math.sqrt(Hlong*Hlong + Mlong*Mlong - 2*Hlong*Mlong*math.cos(math.radians(degree))))

### FIXED CODE ###

from math import *
a, b, h, m = map(int, input().split())
h = 30 * h + m / 2
m *= 6
d = (a * sin(radians(h))) - (b * sin(radians(m)))
e = (a * cos(radians(h))) - (b * cos(radians(m)))
print((d * d + e * e)**0.5)
w = ["Sunny","Cloudy","Rainy"]
s = input()
print(w[(w.index(s)+1)%3]

### FIXED CODE ###

w = ["Sunny","Cloudy","Rainy"]
s = input()
print(w[(w.index(s)+1)%3])
a, b , c, d = map(int, input().split())
if b <= c or d<=a:
    print(0)
elif b > c and b <= d:
    print(b-c)
elif c <= a and d<= b:
    print(d-a)
elif (d-c)>=(b-a):
    print(b-a)
elif (b-a)>= (d-c):
    print(d-c)
    

### FIXED CODE ###

n = input()
if n[0] == n[2]:
    print("Yes")
else:
    print("No")
# AGC 015: A – A+...+B Problem
from itertools import combinations_with_replacement

n, a, b = [int(s) for s in input().split()]


if a == b:
    print(1)
elif a > b or n == 1:
    print(0)
else:
    candidates = list(combinations_with_replacement(range(a, b + 1), n - 2))
    sum_variations = []

    for candidate in candidates:
        if sum(candidate) not in sum_variations:
            sum_variations.append(sum(candidate))
    
    print(len(sum_variations))

### FIXED CODE ###

# AGC 015: A – A+...+B Problem
from itertools import combinations_with_replacement

n, a, b = [int(s) for s in input().split()]


if a == b:
    print(1)
elif a > b or n <= 2:
    print(0)
else:
    print((b - a) * (n - 2) + 1)
N = int(input())

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

A_sorted = sorted(A_list)

pos_count = len([a for a in A_sorted if a >= 0])
neg_count = len([a for a in A_sorted if a < 0])

output_list = [0] * (N - 1)
count = 0
for q in range(neg_count, N - 1):
    output_list[count] = [A_sorted[0], A_sorted[q]]
    count += 1
    A_sorted[0] -= A_sorted[q]


for i in range(neg_count):
    output_list[count] = [A_sorted[N - 1], A_sorted[i]]
    count += 1
    A_sorted[N - 1] -= A_sorted[i]

print(A_sorted[N - 1])
for item in output_list:
    print(item[0], item[1])

### FIXED CODE ###

N = int(input())

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

A_sorted = sorted(A_list)

pos_count = len([a for a in A_sorted if a >= 0])
neg_count = len([a for a in A_sorted if a < 0])

if pos_count == 0:
    pos_count = 1
    neg_count = N - 1
if neg_count == 0:
    pos_count = N - 1
    neg_count = 1

output_list = [0] * (N - 1)
count = 0
for q in range(neg_count, N - 1):
    output_list[count] = [A_sorted[0], A_sorted[q]]
    count += 1
    A_sorted[0] -= A_sorted[q]


for i in range(neg_count):
    output_list[count] = [A_sorted[N - 1], A_sorted[i]]
    count += 1
    A_sorted[N - 1] -= A_sorted[i]

print(A_sorted[N - 1])
for item in output_list:
    print(item[0], item[1])
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(o)] + e[len(e)])
else:
  list.append(o[len(o)])
  
 
print(*list, sep='')

### FIXED CODE ###

o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(o)-1] + e[len(e)-1])
else:
  list.append(o[len(o)-1])
  
 
print(*list, sep='')
s = str(input())
j = len(s)
l = []
for i in range(j):
    for ii in range(i, j):
        ss = int(s[i:ii + 1])
        if not ss:
            continue
        sss = ss / 2019
        if sss.is_integer():
            l.append(ss)

print(len(l))


### FIXED CODE ###

s = input()[::-1]

cnts = [0] * 2019
cnts[0] = 1

n, d = 0, 1

for char in s:
    n = (n + int(char) * d) % 2019
    d = d * 10 % 2019
    cnts[n] += 1

ans = 0
for cnt in cnts:
    ans += cnt * (cnt - 1) // 2

print(ans)
N = int(input())
S = list(str(input()))
K = int(input())

SK = str(S[K])
for i in range(0,N):
    if S[i] == SK:
        pass
    else:
        S[i] = '*'
print(S, end="")

### FIXED CODE ###

N = int(input())
S = list(str(input()))
K = int(input())

SK = str(S[K-1])
for i in range(0,N):
    if S[i] == SK:
        pass
    else:
        S[i] = '*'
for j in S:
  print(j, end ="")
n = int(input())
a = [int(x) for x in input().split()]

def gcd(x, y):
    #print('gcd({0},{1})'.format(x,y))
    if (y==0):
        return x
    else:
        return gcd(y, x%y)

def gcd_left(i):
    #print('gcd_left({0})'.format(i))

    if i==-1:
        return 0
    else:
        return gcd(gcd_left(i-1), a[i])

def gcd_right(i):
    #print('gcd_left({0})'.format(i))
    
    if i==n:
        return 0
    else:
        return gcd(a[i],gcd_right(i+1))

def gcd_excepts(i):
    #print('gcd_excepts({0})'.format(i))

    return gcd( gcd_left(i-1), gcd_right(i+1))

m = [gcd_excepts(i) for i in range(n)]

print(max(m))

### FIXED CODE ###

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

def gcd(x, y):
    #print('gcd({0},{1})'.format(x,y))
    if (y==0):
        return x
    else:
        return gcd(y, x%y)

def gcd_left(i):
    #print('gcd_left({0})'.format(i))

    if i<=-1:
        return 0
    else:
        if l[i]:
            return gcd(gcd_left(i-1), a[i])
        else:
            l[i] = gcd( gcd_left(i-1), gcd_right(i+1))


def gcd_right(i):
    #print('gcd_left({0})'.format(i))
    
    if i>=n:
        return 0
    else:
        return gcd( a[i], gcd_right(i+1))

def gcd_left_update(ls, i):
    #print('gcd_left({0})'.format(i))

    if i<0:
        return 0
    elif i==0:
        return a[i]
    else:        
        return gcd(ls[i-1], a[i])


def gcd_right_update(ls, i):
    #print('gcd_right({0})'.format(i))
    
    if i>=n:
        return 0
    elif i==n-1:
        return a[i]
    else:
        return gcd( a[i], ls[i+1])

def gcd_excepts(i):
    #print('gcd_excepts({0})'.format(i))
    return gcd( gcd_left(i-1), gcd_right(i+1))

def gcd_excepts2(i):
    #print('gcd_excepts2({0})'.format(i))
    left = 0
    right = 0
    if i-1<0:
        left = 0
    else:
        left = l[i-1]
    
    if i+1>=n:
        right = 0
    else:
        right = r[i+1]
        
    return gcd( left, right )

l = [None for i in range(n)]
for i in range(n):
    l[i] = gcd_left_update(l,i)

r = [None for i in range(n)]
for i in reversed(range(n)):
    r [i] = gcd_right_update(r,i)
    
m = [gcd_excepts2(i) for i in range(n)]

print(max(m))
import itertools
N = int(input())
A = [[int(_) for _ in input().split()] for _ in range(N)]
ans = sum(sum(a) for a in A)
seen = set()
for k, i, j in itertools.product(range(N), repeat=3):
    if (i, j) in seen or k == i or i == j or j == k:
        continue
    elif A[i][j] > A[i][k] + A[j][k]:
        print(-1)
        exit()
    elif A[i][j] == A[i][k] + A[j][k]:
        ans -= A[i][j]
        seen.add((i, k))
        seen.add((k, i))
        seen.add((j, k))
        seen.add((k, j))
    seen.add(i, j)
    seen.add(j, i)
print(ans // 2)


### FIXED CODE ###

import itertools
N = int(input())
A = [[int(_) for _ in input().split()] for _ in range(N)]
ans = sum(sum(a) for a in A) // 2
seen = set()
for i in range(N):
    for j in range(i + 1, N):
        for k in range(N):
            if A[i][j] > A[i][k] + A[j][k]:
                print(-1)
                exit()
            elif k == i or i == j or j == k:
                continue
            elif A[i][j] == A[i][k] + A[j][k]:
                ans -= A[i][j]
                break
print(ans)
#include<iostream>

int main()
{
int a,b;
std::cin >> a >> b;
std::cout << a*b << "/n";
std::cout << 2*(a+b);

return 0;
}


### FIXED CODE ###

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

print( a*b, 2*(a+b) )
# -*- coding: utf-8 -*-

H,W = map(int, input().split())
a = [list(map(int, input().split())) for i in range(H)]
a_eo = [[a[i][j] % 2 for j in range(W)] for i in range(H)]

N = 0
move = ""
for i in range(H):
    for j in range(W):
        if a_eo[i][j] == 1:
            if j < W-1 and 1 in a_eo[i][j+1:]:
                a[i][j] -= 1
                a[i][j+1] += 1
                a_eo[i][j] = 0
                a_eo[i][j+1] = (a_eo[i][j+1] + 1) % 2
                N += 1
                move += "%d %d %d %d\n" % (i+1, j+1, i+1, j+1+1)
            elif i < H-1 and 1 not in a_eo[i][j+1:]:
                a[i][j] -= 1
                a[i+1][j] += 1
                a_eo[i][j] = 0
                a_eo[i+1][j] = (a_eo[i][j+1] + 1) % 2
                N += 1
                move += "%d %d %d %d\n" % (i+1, j+1, i+1+1, j+1)
            else:
                break

print("%d\n" % N + move)


### FIXED CODE ###

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

H,W = map(int, input().split())
a = [list(map(int, input().split())) for i in range(H)]
a_eo = [[a[i][j] % 2 for j in range(W)] for i in range(H)]

N = 0
move = ""
for i in range(H):
    for j in range(W):
        if a_eo[i][j] == 1:
            if j < W-1 and 1 in a_eo[i][j+1:]:
                a[i][j] -= 1
                a[i][j+1] += 1
                a_eo[i][j] = 0
                a_eo[i][j+1] = (a_eo[i][j+1] + 1) % 2
                N += 1
                move += "%d %d %d %d\n" % (i+1, j+1, i+1, j+1+1)
            elif i < H-1 and 1 not in a_eo[i][j+1:]:
                a[i][j] -= 1
                a[i+1][j] += 1
                a_eo[i][j] = 0
                a_eo[i+1][j] = (a_eo[i+1][j] + 1) % 2
                N += 1
                move += "%d %d %d %d\n" % (i+1, j+1, i+1+1, j+1)
            else:
                break

print("%d\n" % N + move)
# N個のマス
N = int(input())

# タイルの高さ（H）のリスト
H_list = int(input().split())

Judge = True

# 最初のマスは,単調非現象にするには必ず１低くするのが最適
H_list(0)-=1

for i in range(N-1):
    # 右側i+1のマスが高ければ必ず１低くする
    if H_list(i) < H_list(i+1):
        H_list(i+1)-=1
    elif H_list(i) > H_list(i+1):
    # 左側が高くなれば　単調非現象は成立しない
        Judge = False

if Judge == True:
    print('Yes')
else:
    print('No')

### FIXED CODE ###


# N個のマス
N = int(input())

# タイルの高さ（H）のリスト
H_list = list(map(int,input().split()))

Judge = True

# 最初のマスは,単調非現象にするには必ず１低くするのが最適
H_list[0]-=1

for i in range(N-1):
    # 右側i+1のマスが高ければ必ず１低くする
    if H_list[i] < H_list[i+1]:
        H_list[i+1]-=1
    elif H_list[i] > H_list[i+1]:
    # 左側が高くなれば　単調非現象は成立しない
        Judge = False

if Judge == True:
    print('Yes')
elif Judge == False:
    print('No')
n, m = map(int, input().split())
S = []
C = []
for i in range(m):
  s,c = map(int, input().split())
  S.append(s)
  C.append(c)
  
for j in range(m):
  if S[j] == 1 and C[j] == 0:
    print('-1')
    break
  elif S[j] in S:
    l = S.index(S[j])
    if C[l] != C[j]:
      print('-1')
      break
  else:
    continue

h1 = C[S.index(1)]
h2 = 0
h3 = 0
if int(2) in S:
  h2 = C[S.index(2)]

if int(3) in S: 
  h3 = C[S.index(3)]
  
print(100*h1 + 10*h2 + h3)

### FIXED CODE ###

n,m=map(int,input().split())
data=[-1]*n
for i in range(m):
  s,c=map(int,input().split())
  if (s==1 and c==0) and n>=2:
    print(-1)
    exit()
  if data[s-1]==-1 or data[s-1]==c:
    data[s-1]=c
  elif data[s-1]!=-1 and data[s-1]!=c:
    print(-1)
    exit()
  
if data[0]==-1 and n!=1:
  data[0]=1
elif data[0]==-1 and n==1:
  data[0]=0
for i in range(1,n):
  if data[i]==-1:
    data[i]=0
print(*data,sep='')
from heapq import*
import sys;sys.setrecursionlimit(200000)
h,w=map(int,input().split())
grid=[["#"]*(w+2)]+[list("#"+input()+"#") for x in range(h)]+[["#"]*(w+2)]

g=0
x=1
y=1
lock=[]
for x in range(1,1+h):
    for y in range(1,1+w):
        if grid[y][x]=="#":
            heappush(lock,(y,x))
#print(lock)


while 1:
    locked=[]
    for y,x in lock:
        if grid[y][x]=='#':
            for i,j in([0,1],[1,0],[0,-1],[-1,0]):
                if grid[y+i][x+j]!="#":
                    if (y+i,x+j)in locked:
                        continue
                    else:
                        grid[y+i][x+j]="#"
                        heappush(locked,(y+i,x+j))
    g+=1
    lock=locked
#    print(lock)
#    for i in grid:
#        print(*i)
#    print()
    if all(all(j=="#" for j in i)for i in grid):
        print(g)
        exit()

### FIXED CODE ###

from heapq import*
h,w=map(int,input().split())
grid=[["#"]*(w+2)]+[list("#"+input()+"#")for x in range(h)]+[["#"]*(w+2)]

stack=[]
for y in range(1,h+1):
    for x in range(1,w+1):
        if grid[y][x]=="#":
            grid[y][x]=0
            stack.append((y,x))

for i in range(h*w):
    tmp=[]
    for my,mx in stack:
        for y,x in ([0,1],[1,0],[-1,0],[0,-1]):
            if grid[my+y][mx+x]==".":
                grid[my+y][mx+x]=i+1
                tmp.append([my+y,mx+x])
    stack=tmp
    if len(tmp)==0:
        print(i)
        break
s=input()

output=[]

for i in range(len(s)):
    if s[i]=='0':
        output.append('0')
    elif s[i]=='1':
        output.append('1')
    elif s[i]=='B':
        if len(output)!=0:
            del output[i-1]

for i in range(len(output)):
    print(output[i],end="")

### FIXED CODE ###

s=input()

output=[]

for i in range(len(s)):
    if s[i]=='0':
        output.append('0')
    elif s[i]=='1':
        output.append('1')
    elif s[i]=='B':
        if len(output)!=0:
            del output[len(output)-1]

for i in range(len(output)):
    print(output[i],end="")
L = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

def is_prime_2(n):
  a = int(n ** 0.5)
  for i in L:
    if i > a:return True
    if n % i == 0:return False
  return True

def prime_count(n):
  result = 0
  if n >= 2:result+=1
  for i in range(3,n+1,2):
    if is_prime_2(i):result+=1
  return result

while 1:
  print(prime_count(int(input())))

### FIXED CODE ###

import sys
import time

MAX = 999999

def is_prime(n):
  if n == 2:return True
  if n % 2 == 0:return False
  for i in range(3,int(n**0.5)+1,2):
    if n % i == 0:return False
  return True

def prime_list(n):
  return ([2] if n > 1 else []) + [i for i in range(3,n+1,2) if is_prime(i)]

L = prime_list(int(MAX**0.5))

def is_prime_2(n):
  a = int(n ** 0.5)
  for i in L:
    if i > a:return True
    if n % i == 0:return False
  return True

def prime_count(n):
  result = 0
  if n >= 2:result+=1
  for i in range(3,n+1,2):
    if is_prime_2(i):result+=1
  return result

def prime_list2(n):
  return ([2] if n > 1 else []) + [i for i in range(3,n+1,2) if is_prime_2(i)]

L2 = prime_list2(MAX)

def prime_count_2(n):
  for i,v in enumerate(L2):
    if v > n:return i
  return len(L2)

for n in sys.stdin:
  print(prime_count_2(int(n)))
import numpy as np

def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)

def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g
n,x = map(int,input().split())
arr = list(map(int,input().split()))
arr = np.array(arr)
arr -= x
arr = np.abs(arr)
# print(arr)

if len(arr) == 0:
    print(arr[0])
else:
    print(gcd(arr))

### FIXED CODE ###

import numpy as np

def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)

def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g
n,x = map(int,input().split())
arr = list(map(int,input().split()))
arr = np.array(arr)
arr -= x
arr = np.abs(arr)
# print(arr)

if len(arr) == 1:
    print(arr[0])
else:
    print(gcd(arr))
"""
強連結成分分解
"""


def dfs(v, visited, edges, order):
  visited[v] = True
  for to in edges[v]:
    if not visited[to]:
      dfs(to, visited, edges, order)
  order.append(v)

def search_strongly_connection(v, visited, reverse_edges, parent):
  visited[v] = True
  for to in reverse_edges[v]:
    if not visited[to]:
      parent[to] = v
      search_strongly_connection(to, visited, reverse_edges, parent)

def find(parent, x):
  if parent[x] == x:
    return x
  tmp = find(parent, parent[x])
  parent[x] = tmp
  return tmp

v_num , e_num = map(int, input().split())
edges = [[] for _ in range(v_num)]
reverse_edges = [[] for _ in range(v_num)]
for _ in range(e_num):
  s, t = map(int, input().split())
  edges[s].append(t)
  reverse_edges[t].append(s)


order = []
visited = [False] * v_num
for v in range(v_num):
  if not visited[v]:
    dfs(v, visited, edges, order)
order.reverse()


visited = [False] * v_num
parent = [i for i in range(v_num)]
for v in order:
  if not visited[v]:
    search_strongly_connection(v, visited, reverse_edges, parent)

q_num = int(input())
for _ in range(q_num):
  u, v = map(int, input().split())
  if find(parent, u) == find(parent, v):
    print(1)
  else:
    print(0)


### FIXED CODE ###

"""
強連結成分分解
"""

import sys

sys.setrecursionlimit(1000000)

def dfs(v, visited, edges, order):
  visited[v] = True
  for to in edges[v]:
    if not visited[to]:
      dfs(to, visited, edges, order)
  order.append(v)

def search_strongly_connection(v, visited, reverse_edges, parent, num):
  visited[v] = True
  for to in reverse_edges[v]:
    if not visited[to]:
      parent[to] = num
      search_strongly_connection(to, visited, reverse_edges, parent, num)

def main():
  v_num , e_num = map(int, input().split())
  edges = [[] for _ in range(v_num)]
  reverse_edges = [[] for _ in range(v_num)]
  for _ in range(e_num):
    s, t = map(int, input().split())
    edges[s].append(t)
    reverse_edges[t].append(s)
  
  
  order = []
  visited = [False] * v_num
  for v in range(v_num):
    if not visited[v]:
      dfs(v, visited, edges, order)
  order.reverse()
  
  
  visited = [False] * v_num
  parent = [i for i in range(v_num)]
  for v in order:
    if not visited[v]:
      search_strongly_connection(v, visited, reverse_edges, parent, v)
  
  q_num = int(input())
  for _ in range(q_num):
    u, v = map(int, input().split())
    print(1 if parent[u] == parent[v] else 0)

main()
import sys
sys.setrecursionlimit(10**7)
n,m=map(int,input().split())
g=[[] for _ in range(n)]
for _ in range(m):
    u,v=map(int,input().split())
    u,v=u-1,v-1
    g[u].append(v)
mi=set(range(n))
flg=False
def func(path):
    if len(path)!=2:
        for v in path:
            nvs=[nv for nv in g[v] if nv in path]
            if len(nvs)==1:continue
            end=set(nvs)
            end.add(v)
            for nv in nvs:
                ary={v}
                ary.add(nv)
                nv=g[nv][0]
                while nv not in end:
                    ary.add(nv)
                    nv=g[nv][0]
                if nv==v:
                    func(ary)
    print(len(path))
    for v in path:
        print(v+1)
    exit()


def dfs(v,seen):
    mi.discard(v)
    for nv in g[v]:
        if seen[nv]!=-1:# 巡回閉路
            seen[nv]=v
            path={v}
            while seen[v] not in path:
                v=seen[v]
                path.add(v)
            func(path)
        else:
            seen[nv]=v
            dfs(nv,seen)
            seen[nv]=-1
while mi:
    v=mi.pop()
    seen=[-1]*n
    dfs(v,seen)
print(-1)
exit()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n,m=map(int,input().split())
g=[[] for _ in range(n)]
for _ in range(m):
  u,v=map(int,input().split())
  u,v=u-1,v-1
  g[u].append(v)
mi=set(range(n))
flg=False
def func(path):
  chk=set(path)
  if len(path)!=2:
    for i,v in enumerate(path):
      nvs=[nv for nv in g[v] if nv in chk]
      if len(nvs)==1:continue
      for nv in nvs:
        if nv==path[(i+1)%len(path)]:continue
        ary=[nv]
        for j,vj in enumerate(path):
          if vj==nv:break
        if i>j:
          ary=path[j:i+1]
        else:
          ary=path[:i+1]+path[j:]
        #print(path,ary,i,j)
        func(ary)
  print(len(path))
  for v in path:
    print(v+1)
  exit()

def dfs(v,seen):
  mi.discard(v)
  for nv in g[v]:
    if seen[nv]!=-1:# 巡回閉路
      seen[nv]=v
      path=[v]
      chk={v}
      while seen[v] not in chk:
        v=seen[v]
        path.append(v)
        chk.add(v)
      path.reverse()
      func(path)
    else:
      seen[nv]=v
      dfs(nv,seen)
      seen[nv]=-1
while mi:
  v=mi.pop()
  seen=[-1]*n
  dfs(v,seen)
print(-1)
exit()
n = input()
sum = 0
for i in range(n):
  amount, name = input().split()
  amount = float(amount)
  if name == "BTC":
    sum += amount * 380000
  else:
    sum += amount
    
print(sum)

### FIXED CODE ###

n = int(input())
sum = 0
for i in range(n):
  amount, name = input().split()
  amount = float(amount)
  if name == "BTC":
    sum += 380000 * amount
  else:
    sum += amount

print(sum)
import numpy as np
N = int(input())
S = input()
ans = 0
for i in range(0, N):
    for j in range(i, N):
        if i ==j or S[i] == S[j]:
            continue
        s = ['R', 'G', 'B']
        s.remove(S[i])
        s.remove(S[j])
        k_s = np.where(np.array(list(S[j:])) == s[0])[0] + j
        for k in k_s:
            if j == k or S[j] == S[k]:
                continue
            elif j-i != k-j and S[i] != S[k]:
                ans += 1
print(ans)


### FIXED CODE ###

N = int(input())
S = input()
ans = S.count("R") * S.count("G") * S.count("B")
for i in range(N):
    for j in range(i + 1, N):
        k = j - i + j
        if k < N:
            if {S[i], S[j], S[k]} == {"R", "G", "B"}:
                ans -= 1
print(ans)
N = int(input())
A = sorted(map(int, input().split()))
res = 1

if 0 in A :
    print(0)
    exit()

for x in range(N) :
    res = res*A[x]
    if res > 10E+17
        print(-1)
        break

print(res)

### FIXED CODE ###

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

limit = 10 ** 18
A.sort()
result = A[0]
for a in A[1:]:
    result *= a
    if result > limit:
        print(-1)
        exit()
print(result)
x = int(input())

my_dict = dict()

for i in range(1000):
    my_dict[i**5] = i

for i in range(-1000, 1000):
    target = x + (i ** 5)
    if (- target) in my_dict:
        print(-my_dict[target], i)
        exit()
    elif target in my_dict:
        print(my_dict[target], i)
        exit()


### FIXED CODE ###

x = int(input())

my_dict = dict()

for i in range(1000):
    my_dict[i**5] = i

for i in range(-1000, 1000):
    target = x + (i ** 5)
    if (- target) in my_dict:
        print(-my_dict[-target], i)
        exit()
    elif target in my_dict:
        print(my_dict[target], i)
        exit()
H,W,M=map(int, input().split())
sumh=[0]*H
sumw=[0]*W
s=[[0]*W for _ in range(H)]
for i in range(M):
  h,w=map(int, input().split())
  sumh[h-1]+=1
  sumw[w-1]+=1
  s[h-1][w-1]=1

maxh=maxw=0
qh=[]
qw=[]
for i in range(H):
  maxh=max(maxh, sumh[i])
for i in range(H):
  if maxh==sumh[i]:
    qh.append(i)

for i in range(W):
  maxw=max(maxw, sumw[i])
for i in range(W):
  if maxw==sumw[i]:
    qw.append(i)

for i in qh:
  for j in qw:
    if s[i][j]==0:
      print(maxh+maxw)
      exit()

print(maxh+maxw-1)

### FIXED CODE ###

H,W,M=map(int, input().split())
sumh=[0]*H
sumw=[0]*W
bomb=[]
for i in range(M):
  h,w=map(int, input().split())
  sumh[h-1]+=1
  sumw[w-1]+=1
  bomb.append((h,w))

maxh=max(sumh)
maxw=max(sumw)
ch=sumh.count(maxh)
cw=sumw.count(maxw)

cnt=0
for h,w in bomb:
  if sumh[h-1]==maxh and sumw[w-1]==maxw:
    cnt+=1

if cnt==ch*cw:
  print(maxh+maxw-1)
else:
  print(maxh+maxw)
N = int(input())
S = list(input())


l_sum = []
r_sum = []
sum_list = []

l_c = 0
r_c = 0

for i in range(1,N):
	if S[i-1] == '#':
		l_c = l_c + 1
	l_sum.extend([l_c])
	if S[N-i] == '.':
		r_c = r_c + 1
	r_sum.insert(0,r_c)

#print(l_sum)
#print(r_sum)
sum_list = [x + y for (x,y) in zip(l_sum,r_sum)]
print(min(sum_list))


### FIXED CODE ###

N = int(input())
S = list(input())

c_b = 0
c_w = S.count('.')
sum = []

for i in S:
	if i == '.':
		c_w = c_w - 1
	sum.extend([c_b+c_w])
	if i == '#':
		c_b = c_b + 1

print(min(sum))