Problem:


Score : 200 points

Problem Statement

Takahashi received otoshidama (New Year's money gifts) from N of his relatives.

You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.

For example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.

If we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?

Constraints

2 \leq N \leq 10

u_i = JPY or BTC.

If u_i = JPY, x_i is an integer such that 1 \leq x_i \leq 10^8.

If u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \leq x_i \leq 100.00000000.

Input

Input is given from Standard Input in the following format:

N
x_1 u_1
x_2 u_2
:
x_N u_N

Output

If the gifts are worth Y yen in total, print the value Y (not necessarily an integer).

Output will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.

Sample Input 1

2
10000 JPY
0.10000000 BTC

Sample Output 1

48000.0

The otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.

Outputs such as 48000 and 48000.1 will also be judged correct.

Sample Input 2

3
100000000 JPY
100.00000000 BTC
0.00000001 BTC

Sample Output 2

138000000.0038

In this case, outputs such as 138001000 and 1.38e8 will also be judged correct.



Sample input:
2
10000 JPY
0.10000000 BTC


Sample output:
48000.0

Submission status: Runtime Error

Solution code:
def calc(val, unit):
	if unit == 'BTC':
		val *= 380000
	return val

sum41 = 0
n = int(input())
for i in range(n):
	tmp = input().rstrip('\n').split(' ')
	sum41 += calc(tmp[0], tmp[1])

print(1.0 * sum41)

Submission status: Runtime Error

Solution code:
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int k=sc.nextInt();
		sc.nextLine();
		String s[]=new String[k];
		for(int i=0;i<k;i++){
			s[i]=sc.nextLine();
		}
		System.out.println(solve(s));
	}

	private static double solve(String[] s) {
		// TODO Auto-generated method stub
		double result=0;
		for(String str:s){
			String tmp=str.split(" ")[0];
			if(str.indexOf("JPY")>=0){

				result+=Double.parseDouble(tmp);
			}else{
				result+=Double.parseDouble(tmp)*380000;
			}
		
		}
		return result;
	}

	private static int[] nextArr(int k) {
		// TODO Auto-generated method stub
		int[] res = new int[k];
		for (int i = 0; i < k; i++) {

			res[i] = sc.nextInt();
		}
		return res;
	}

}

Submission status: Runtime Error

Solution code:
N = int(input())
u = [input().split() for _ in range(N)]

Y=0
for i in u:
    if i[i][0]=="JPY":
        Y+=u[i][1]
    else:
        Y+=u[i][1]*380000

print(Y)

Submission status: Runtime Error

Solution code:
N = float(input())
EBTC = 380000.0
R = 0
for i in range(N):
    t = [x for x in input().split()]
    R = R + float(t[0]) if t[1]=="JPY" else R + float(t[0])*EBTC
print(int(R))

Submission status: Runtime Error

Solution code:
N = int(input())
u = [list(map(int, input().split())) for _ in range(N)]

Y=0
for i in u:
    if i[i,0]=="JPY":
        Y+=u[i,1]
    else:
        Y+=u[i,1]*380000

print(Y)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
int N;
float money = 0;

int main(int argc, char const *argv[]) {
  cin >> N;
  for (int i=0, i < N; i++){
    int value;
    string coin;
    cin >> value >> coin;
    if(coin == "JPY"){
      money + value;
    }
    else{
      money + value * 380000.0
    }

  }


  return 0;
}

Submission status: Runtime Error

Solution code:
Ot = 0
N = int(input())
for i in range (N):
    X = input().split()
    x = int(X[0])
    if X[1] == "BTC":
        Ot += x * 380000
    else:
        Ot += x
print(Ot)

Submission status: Runtime Error

Solution code:
N = input()

yen = 0.
for i in range(N):
	x, u = input().split(' ')
	if u == 'JPY':
		yen += float(x)
	elif u == 'BTC':
		yen += 380000.0*float(x)

print(yen)

Submission status: Runtime Error

Solution code:
ret = 0 
psn = int ( input () )
for i in range (psn) :
    m,t = input ( )
    m = float ( m )
    if t = "BTC" :
        m = 380000 * m
	ret += m
print ( ret )

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <functional>
#include <queue>
#include <regex>
#include <cassert>
#include <map>
#include <type_traits>
#include <array>
#include <cassert>
#include <typeinfo>
#include <time.h>
//#include "boost/variant.hpp"

// #include "bits/stdc++.h"

using namespace std;



#define rep(i, N, M) for(ll i=N, i##_len=(M); i<i##_len; ++i)
#define rep_skip(i, N, M, ...) for(ll i=N, i##_len=(M); i<i##_len; i+=(skip))
#define rrep(i, N, M)  for(ll i=(M)-1, i##_len=(N-1); i>i##_len; --i)
#define pb push_back

typedef pair<double, double> pd;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;
typedef tuple<ll, ll, ll, ll> tll4;
typedef tuple<ll, ll, ll, ll, ll> tll5;
typedef tuple<ll, ll, ll, ll, ll, ll> tll6;

typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
template<typename T>
using pq_greater = priority_queue<T, vector<T>, greater<T>>;


#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vec(a) vector<a>
#define perm(c) sort(all(c));for(bool c##perm=1;c##perm;c##perm=next_permutation(all(c)))

template<typename T1, typename T2> void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> void chmax(T1 &a, T2 b) { if (a < b) a = b; }

vll seq(ll i, ll j) { 
	vll res(j - i); 
	rep(k, i, j) res[k] = i + k; 
	return res; 
}

constexpr ll POW_(ll n, ll m) {
	ll res = 1;
	rep(i, 0, m) {
		res *= n;
	}
	return res;
}

template<int mod = 0>
constexpr ll POW(ll x, ll n) {
	if (x == 2)
	{
		return (1LL << n) % mod;
	}
	if (n == 0)return 1;
	if (n == 1)return x % mod;
	if (n % 2 == 0)return POW_(POW<mod>(x, n / 2), 2LL) % mod;
	return ((POW_(POW<mod>(x, n / 2, mod), 2LL) % mod)*(x%mod)) % mod;
}
template<>
constexpr ll POW<0>(ll x, ll n) {
	if (x == 2)
	{
		return 1LL << n;
	}
	if (n == 0)return 1;
	if (n == 1)return x;
	if (n % 2 == 0) return POW_(POW(x, n / 2), 2);
	return (POW_(POW(x, n / 2), 2))*x;
}

template<ll bit>
ll at_bit(ll n, ll i) {
	return n / POW(bit, i) % bit;
}

template<>
ll at_bit<2>(ll n, ll i) {
	return (n >> i) % 2LL;
}

template<ll bit>
ll get_bit(ll i) {
	return POW(bit, i);
}

template<>
ll get_bit<2>(ll i) {
	return 1LL << i;
}

template<ll bit = 2>
ll get_max_bit(ll n) {
	ll tmp = bit;
	ll at = 0;
	while (tmp <= n) {
		at++;
		tmp *= bit;
	}
	return at;
}

template<>
ll get_max_bit<2>(ll n) {
	ll tmp = 2;
	ll at = 0;
	while (tmp <= n) {
		at++;
		tmp <<= 1;
	}
	return at;
}

vll getDivisors(ll n) {
	vll res;
	ll i = 1;

	for (; i*i < n; i++) {
		if (n%i == 0) {
			res.push_back(i);
			res.push_back(n / i);
		}
	}
	if (i*i == n)res.push_back(i);
	sort(res.begin(), res.end());
	return res;
}

vll getDivisors(ll n, ll m) {
	if (n > m) swap(n, m);
	vll res;
	ll i = 1;

	for (; i*i < n; i++) {
		if (n%i == 0) {
			if (m%i == 0) res.push_back(i);
			if (m % (n / i) == 0) res.push_back(n / i);
		}
	}
	if (i*i == n) if (m%i == 0) res.push_back(i);
	sort(res.begin(), res.end());
	return res;
}


ll gcd(ll a, ll b) {
	if (a%b == 0) return b;
	else return gcd(b, a%b);
}

template<
	typename Inputs,
	typename Functor,
	typename T = typename Inputs::value_type>
	void sort_by(Inputs& inputs, Functor f) {
	std::sort(std::begin(inputs), std::end(inputs),
		[&f](const T& lhs, const T& rhs) { return f(lhs) < f(rhs); });
}

template<
	typename Inputs,
	typename Functor,
	typename T = typename Inputs::value_type>
	void stable_sort_by(Inputs& inputs, Functor f) {
	std::stable_sort(std::begin(inputs), std::end(inputs),
		[&f](const T& lhs, const T& rhs) { return f(lhs) < f(rhs); });
}

// Functor is expected to be functional<val ,bool>
// This function returns the maximum iterator that stisfies f(*it) == f(* inputs.begin())
template<
	typename Inputs,
	typename Functor,
	typename ValType = typename Inputs::value_type>
pair<typename Inputs::iterator, typename Inputs::iterator> binary_solve(Inputs& inputs, Functor f)
{

	auto left = inputs.begin();
	auto right = inputs.end();
	auto n = inputs.size();

	auto left_val = f(*left);
	auto right_val = f(*(right - 1));

	// check 
	assert(n >= 2);
	assert(left_val != right_val);

	while (left + 1 != right)
	{
		auto mid = left + (right - left) / 2;
		if (f(*mid) == left_val)
		{
			left = mid;
		}
		else
		{
			right = mid;
		}
	}

	return { left,right };
}




template<int I>
vll proj(vpll v) {
	vll res(v.size());
	rep(i, 0, v.size()) {
		if (!I) res[i] = v[i].first;
		else res[i] = v[i].second;
	}
	return res;
}


template<int I, class T>
vll proj(T v) {
	vll res(v.size());
	rep(i, 0, v.size()) {
		res[i] = get<I>(v[i]);
	}
	return res;
}
vector<pll >prime_factorize(ll n) {
	vector<pll> res;
	for (ll p = 2; p*p <= n; ++p) {
		if (n%p != 0)continue;
		ll num = 0;
		while (n%p == 0) { ++num; n /= p; }
		res.push_back({ p,num });
	}
	if (n != 1) res.push_back(make_pair(n, 1));
	return res;
}


ll MOD = 998244353;//1000000007;
ll INF = 1LL << 60;
ll n;

template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

template <typename Monoid>
struct segment_tree
{

	using underlying_type = typename  Monoid::underlying_type;

	segment_tree(ll a_n) : size_original(a_n)
	{
		vector<underlying_type> initial_value = vector<underlying_type>(a_n, Monoid::unit());
		segment_tree_impl(a_n, initial_value);
	}

	segment_tree(ll a_n, vector<underlying_type>& initial_value) : size_original(a_n)
	{
		segment_tree_impl(a_n, initial_value);
	}

	void update(int i, underlying_type z) { // 0-based
		assert(0 <= i && i < 2 * n - 1);
		a[i + n - 1] = z;
		for (i = (i + n) / 2; i > 0; i /= 2) { // 1-based
			a[i - 1] = Monoid::append(a[2 * i - 1], a[2 * i]);
		}
	}

	underlying_type query(ll l, ll r) { // 0-based, [l, r)
		underlying_type lacc = Monoid::unit(), racc = Monoid::unit();
		assert(l <= r && r <= n);
		l += n; r += n;
		for (; l < r; l /= 2, r /= 2) { // 1-based loop, 2x faster than recursion
			if (l % 2 == 1) lacc = Monoid::append(lacc, a[(l++) - 1]);
			if (r % 2 == 1) racc = Monoid::append(a[(--r) - 1], racc);
		}
		return Monoid::append(lacc, racc);
	}

	ll size() { return size_original; }

private:
	ll size_original;
	ll n;
	vector<underlying_type> a;
	void segment_tree_impl(ll a_n, vector<underlying_type>& initial_value)
	{
		assert(a_n == initial_value.size());
		n = 1; while (n < a_n) n *= 2;
		a.resize(2 * n - 1, Monoid::unit());
		rep(i, 0, initial_value.size()) {
			a[i + (n - 1)] = initial_value[i];
		}
		rrep(i, 0, n - 1) a[i] = Monoid::append(a[2 * i + 1], a[2 * i + 2]); // propagate initial values
	}
};


template <typename T>
struct min_indexed_t {
	typedef pair<T, ll> underlying_type;
	static underlying_type make_indexed(vector<T> v)
	{
		underlying_type w(v.size());
		rep(i, 0, v.size()) {
			w[i] = { v[i],i };
		}
		return w;
	}
	static underlying_type unit() { return make_pair(numeric_limits<T>::max(), -1); }
	static underlying_type append(underlying_type a, underlying_type b) { return min(a, b); }
};
template <typename T>
struct min_t {
	typedef T underlying_type;
	static underlying_type unit() { return numeric_limits<T>::max(); }
	static underlying_type append(underlying_type a, underlying_type b) { return min(a, b); }
};

struct linear_t {
	typedef pd underlying_type;
	static underlying_type unit() { return underlying_type{ 1.,0. }; }
	static underlying_type append(underlying_type a, underlying_type b) {
		return underlying_type{ a.first*b.first, b.first*a.second + b.second };
	}
};



vll get_topologically_sorted_nodes(const vvll& graph)
{
	// graph needs to be represented by adjacent list.
	// complexity: O( node size + edge size)
	ll nodeSize = graph.size();

	// find root
	vll roots;
	vll inDegree(nodeSize);
	rep(i, 0, nodeSize)
	{
		for (ll sibling : graph[i]) {
			inDegree[sibling]++;
		}
	}

	rep(i, 0, nodeSize) {
		if (inDegree[i] == 0) {
			roots.push_back(i);
		}
	}

	stack<ll> parents;
	for (ll i : roots)
		parents.push(i);

	vll sortedNodes;
	while (!parents.empty()) {
		ll parent = parents.top();
		parents.pop();
		sortedNodes.push_back(parent);
		for (ll sibling : graph[parent]) {
			inDegree[sibling]--;
			if (inDegree[sibling] == 0) {
				parents.push(sibling);
			}
		}
	}
	return sortedNodes;
}

struct UnionFind {
	vector<ll> data;
	vll querySize_;
	set<ll> roots;
	UnionFind(ll size) : data(size, -1), querySize_(size, 0) {
		rep(i ,0 ,size) roots.insert(i);
	}

	ll unite(ll x, ll y) {
		// return: root
		x = operator[](x); y = operator[](y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
			querySize_[x] += querySize_[y] + 1;
			roots.erase(y);
			return x;
		}
		else {
			querySize_[x]++;
			return x;
		}
	}
	bool is_same(ll x, ll y) {
		// check whether x and y are connected
		return operator[](x) == operator[](y);
	}
	ll operator[](ll x) {
		// get root
		return data[x] < 0 ? x : data[x] = operator[](data[x]);
	}
	ll size(ll x) {
		return -data[operator[](x)];
	}
	ll  query_size(ll x) {
		return querySize_[operator[](x)];
	}
	const set<ll>& getRoots() {
		return roots;
	}
	ll rank(ll x) {
		return -data[operator[](x)];
	}
	void initialize() {
		for(auto& i : data) {
			i = -1;
		}
	}
};




int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	ll N;
	cin >> N;
	vector<double> x(N);
	vs u(N);
	rep(i, 0, N)cin >> x[i] >> u[i];

	
	double sum = 0;
	rep(i, 0, N) {
		if (u[i] == "JPY") {
			sum += x[i];
		}
		else {
			sum += x[i] * 380000;
		}
	}

	printf("%.8f", sum);

	return 0;
}

Submission status: Runtime Error

Solution code:
ret = 0 
psn = int ( input () )
for i in range (psn) :
  m,t = input ( )
  m = float ( m )
  if t = "BTC" :
    m = 380000 * m
  ret += m

Submission status: Runtime Error

Solution code:
N = int(input())
x = []
u = []
for i in range(N):
  x1,u1 = input().split()
  x.append(float(x1))
  u.append(str(u1))
otoshidama = 0.0
for i in range(N):
  if u[i] = "JPY":
    otoshidama += x[i]
  else:
    otoshidama += x[i]*380000.0
print(otoshidama)

Submission status: Runtime Error

Solution code:
n = int(input())
xs, us = [], []
for _ in range(n):
  x, u = input()
  xs.append(float(x))
  us.append(u)
total_yen = 0
for x, u in zip(xs, us):
  if u == 'BTC':
    total_yen += (x*380000.0)
  else:
    total_yen += x
print(total_yen)

Submission status: Runtime Error

Solution code:
#A


s = input().split("/")
if (s[1] == "04" or s[1] == "4" )and s[2] == "30":
    print("Heisei")
else:
    print("TBD")

#B

n = int(input())
ans = 0
for i in range(n):
    a = input().split()
    if a[1] == "JPY":
        ans += int(a[0])
    else:
        ans +=  float(a[0]) * 380000
print(ans)

Submission status: Runtime Error

Solution code:
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var N int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d", &N)

	var sum float32
	for i := 0; i < N; i++ {
		var c float32
		var str string
		scanner.Scan()
		fmt.Sscanf(scanner.Text(), "%f %s", &c, &str)
		if str == "JPY" {
			sum = sum + c
		} else {
			sum = sum + c*380000.0
		}
	}
	fmt.Println(sum)
}

Submission status: Runtime Error

Solution code:
Ot = 0
N = int(input())
for i in range (N):
  X = input().split()
  x = int(X[0])
  if X[1] == "BTC":
    Ot += x * 380000
  else:
    Ot += x
print(Ot)

Submission status: Runtime Error

Solution code:
import sys

v = []
for line in sys.stdin:
    v = [i for i in line.split()]

m = 0
for a, b in v[1:]:
  a = float(a)
  if b == "JPY":
    m += a
  else:
    m += 380000.0 * a
print(m)

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 0
for i in range(n):
    x, u = input().split()
    s = float(x)
    if u = "JPY":
        ans += s
    else:
        ans += (s * 380000.0)
print(s)

Submission status: Runtime Error

Solution code:
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var N int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d", &N)

	sum := 0.0
	for i := 0; i < N; i++ {
		var c float64
		var str string
		scanner.Scan()
		fmt.Sscanf(scanner.Text(), "%f %s", &c, &str)
		if str == "JPY" {
			sum = sum + c
		} else {
			sum = sum + c*380000.0
		}
	}
	fmt.Println(sum)
}

Submission status: Runtime Error

Solution code:
N = int(input())
x = [0]*N
u = [0]*N
for i in range(N):
    x[i], u[i] = [int(i) for i in input().split()]

ans = 0
for i in range(N):
    if u[i] == 'JPY':
        ans += x[i]
    else:
        ans += x[i]*380000
print(ans)

Submission status: Runtime Error

Solution code:
#A
"""
s = input().split("/")
if s[1] == "04" and s[2] == "30":
    print("Heisei")
else:
    print("TBD")
"""

#B
n = int(input())
ans = 0
for i in range(n):
    a = input().split()
    if a[1] == "JPY":
        ans += int(a[0])
    else:
        ans += int(a[0]) * 380000
print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n = int(input())

res1 = 0
res2 = 0
for _ in range(n):
    x,u = input().split()
    if u=="JPY":
        res1 += int(x)
    else:
        res2 += float(x)*380000.0

print("{:.8}".format(res1+res2))

Submission status: Runtime Error

Solution code:
n = int(input())
c = 0
for i in range(n):
    a,b = map(input().split())
    if b == 'JPY':
        c += a
    else:
        c +=380000*a
print(c)

Submission status: Runtime Error

Solution code:
n = int(input())
X = [[int(i) for i in input().split()] for j in range(n)]

ans = 0

for x, u in X:
    if u == 'BTC':
        x *= 380000
    ans += x

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
c = 0
for i in range(n):
    a,b = map(int,input().split())
    if b == 'JPY':
        c += a
    else:
        c +=380000*a
print(c)

Submission status: Runtime Error

Solution code:
n=int(input())
ans=0
for i in range(n):
  a,b=map(str,input().split())
  a=int(a)
  if b=="BTC":
    ans+=a*380000
  elif b=="JPY":
    ans+=a
print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n = int(input())

res = 0
for _ in range(n):
    x,u = input().split()
    if u=="JPY":
        res += int(x)
    else:
        res += float(x)*380000.0

print("{:.8}".format(res))

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 0
d = { 'JPY': 1, 'BTC': 380000.0}
for _ in range(n):
  a, b = input().split()
  ans += int(a) * d[b]
print(ans)