import java.io.*;
import java.util.*;
import java.math.*;

public class h2o_aa {
	public static void main(String[] args) {
		new h2o_aa().run();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof = false;

	public void run() {
		Locale.setDefault(Locale.US);
		try {
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(566);
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	void myAssert(boolean u, String message) {
		if (!u) {
			throw new Error("Assertion failed!!! " + message);
		}
	}

	int inBounds(int x, int l, int r, String name) {
		myAssert(l <= x && x <= r, name + " is not in bounds: " + x
				+ " not in [" + l + ", " + r + "]");
		return x;
	}

	String FNAME = "h2o";

	private void solve() throws IOException {
		char[] s = nextToken().toCharArray();
		int ans = 0;
		for (int i = 0; i < s.length; i++) {
			if ('0' <= s[i] && s[i] <= '9') {
				continue;
			}
			int mul = 1;
			if (i + 1 < s.length && '0' <= s[i + 1] && s[i + 1] <= '9') {
				mul = s[i + 1] - '0';
			}
			switch (s[i]) {
			case 'H':
				mul *= 1;
				break;
			case 'C':
				mul *= 12;
				break;
			case 'N':
				mul *= 14;
				break;
			case 'O':
				mul *= 16;
				break;
			default:
				break;
			}
			ans += mul;
		}
		out.println(ans);
	}
}
