P8410 "SvR-1" Don't Mozheng. /oh

Background

**Problem Number:** $\textit{58}$. In the Guluo Academic group chat, everyone is getting "mozheng" (魔怔). ![](https://cdn.luogu.com.cn/upload/image_hosting/iphmcxwz.png) The Luogu blog post "Introduction to Mozheng": . If you need the PDF of "Introduction to Mozheng" (currently updated to version v1.1.1), please download it from "**Problem Attachments**" below.

Description

You are given $n$ messages. There are three types of messages (note that $\texttt$ describes a string named $str$. **This string contains no spaces, and does not contain the characters $\texttt:$ or $\texttt/$. It also does not include the angle brackets on either side**): 1. In the form $\texttt:}$. This means that **the single message on the next line** is sent by the user named $str$. 2. In the form $\texttt{/$ This means an **emoji message** with name $str$. 3. In the form $\texttt$. This means a text message whose content is $str$. After long observation, you found that the **emoji messages** named $\texttt{oh}$ and $\texttt{hsh}$ have a "mozheng" meaning. Also, within a conversation: - One $\texttt{oh}$ emoji increases the mozheng value by $a$. - One $\texttt{hsh}$ emoji increases the mozheng value by $b$. - **Any other message will not affect the mozheng value, and the initial mozheng value is $0$**. Now, for these messages, you need to compute the total mozheng value.

Input Format

The first line contains three integers $n,a,b$, meaning there are $n$ messages in total, and $a,b$ are as described above. The next $2\times n$ lines describe each message: - The first line is a type 1 message. - The second line is a type 2 **or** type 3 message.

Output Format

Output one integer on a single line, the total mozheng value.

Explanation/Hint

#### Explanation for Sample 1 ![](https://cdn.luogu.com.cn/upload/image_hosting/mbfgnv8i.png) As shown in the figure. #### Constraints **This problem uses bundled testdata.** Let $l$ be the maximum length of a single-line message in the input. $$ \newcommand{\arraystretch}{1.5} \begin{array}{c|c|c|c}\hline\hline \textbf{Subtask} & \bm{n\le} & \textbf{Special Property} & \textbf{Score} \\\hline \textsf{1} & \le 10 & - & 20 \\\hline \textsf{2} & \le 100 & - & 20 \\\hline \textsf{3} & \text{No special limit} & \text A & 20 \\\hline \textsf{4} & \text{No special limit} & - & 40 \\\hline\hline \end{array} $$ - Special property $\text{A}$: The input does not contain type 3 messages. For $100\%$ of the data, $1\le n\le 10^4$, $1\le l\le 50$, $1\le a,b\le 10^3$. Translated by ChatGPT 5