{"problem":{"name":"Falling Asleep","description":{"content":"Niwango created a playlist of $N$ songs. The title and the duration of the $i$\\-th song are $s_i$ and $t_i$ seconds, respectively. It is guaranteed that $s_1,\\ldots,s_N$ are all distinct. Niwango was ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2525,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"dwacon6th_prelims_a"},"statements":[{"statement_type":"Markdown","content":"Niwango created a playlist of $N$ songs. The title and the duration of the $i$\\-th song are $s_i$ and $t_i$ seconds, respectively. It is guaranteed that $s_1,\\ldots,s_N$ are all distinct.\nNiwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.) However, he fell asleep during his work, and he woke up after all the songs were played. According to his record, it turned out that he fell asleep at the very end of the song titled $X$.\nFind the duration of time when some song was played while Niwango was asleep.\n\n## Constraints\n\n*   $1 \\leq N \\leq 50$\n*   $s_i$ and $X$ are strings of length between $1$ and $100$ (inclusive) consisting of lowercase English letters.\n*   $s_1,\\ldots,s_N$ are distinct.\n*   There exists an integer $i$ such that $s_i = X$.\n*   $1 \\leq t_i \\leq 1000$\n*   $t_i$ is an integer.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$s_1$ $t_1$\n$\\vdots$\n$s_{N}$ $t_N$\n$X$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"dwacon6th_prelims_a","tags":[],"sample_group":[["3\ndwango 2\nsixth 5\nprelims 25\ndwango","30\n\n*   While Niwango was asleep, two songs were played: `sixth` and `prelims`.\n*   The answer is the total duration of these songs, $30$."],["1\nabcde 1000\nabcde","0\n\n*   No songs were played while Niwango was asleep.\n*   In such a case, the total duration of songs is $0$."],["15\nypnxn 279\nkgjgwx 464\nqquhuwq 327\nrxing 549\npmuduhznoaqu 832\ndagktgdarveusju 595\nwunfagppcoi 200\ndhavrncwfw 720\njpcmigg 658\nwrczqxycivdqn 639\nmcmkkbnjfeod 992\nhtqvkgkbhtytsz 130\ntwflegsjz 467\ndswxxrxuzzfhkp 989\nszfwtzfpnscgue 958\npmuduhznoaqu","6348"]],"created_at":"2026-03-03 11:01:14"}}