🏡 index : github.com/captn3m0/codechef.git

---
{"category_name":"school","problem_code":"TRAVELPS","problem_name":"Travel Pass","problemComponents":{"constraints":"- $1 \\leq T \\leq 10^2$\n- $1 \\leq N, A, B \\leq 10^2$\n- $S_i \\in \\{\u00270\u0027, \u00271\u0027\\}$\n","constraintsState":true,"subtasks":"**Subtask #1 (100 points):** original constraints","subtasksState":true,"inputFormat":"- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\n- Each test case contains two lines of input.\n- First line contains three space separated integers $N, A$ and $B$.\n- Second line contains the string $S$.\n","inputFormatState":true,"outputFormat":"For each testcase, output in a single line the total time Chef has to spend on filling the various forms for his journey.\n","outputFormatState":true,"sampleTestCases":{"0":{"id":1,"input":"3\n2 1 2\n00\n2 1 1\n01\n4 2 1\n1101","output":"2\n2\n5","explanation":"**Test case $1$:** Chef needs total $2$ inter-district e-passes, and he will be filling them in total $1 \\cdot 2 = 2$ minutes.\n\n**Test case $3$:** Chef needs total $1$ inter-district e-pass and $3$ inter-state e-passes, and he will be filling them in total $2 \\cdot 1 + 1 \\cdot 3 = 5$ minutes.","isDeleted":false}}},"video_editorial_url":"https://youtu.be/Vth8Kd1YISU","languages_supported":{"0":"CPP14","1":"C","2":"JAVA","3":"PYTH 3.6","4":"CPP17","5":"PYTH","6":"PYP3","7":"CS2","8":"ADA","9":"PYPY","10":"TEXT","11":"PAS fpc","12":"NODEJS","13":"RUBY","14":"PHP","15":"GO","16":"HASK","17":"TCL","18":"PERL","19":"SCALA","20":"LUA","21":"kotlin","22":"BASH","23":"JS","24":"LISP sbcl","25":"rust","26":"PAS gpc","27":"BF","28":"CLOJ","29":"R","30":"D","31":"CAML","32":"FORT","33":"ASM","34":"swift","35":"FS","36":"WSPC","37":"LISP clisp","38":"SQL","39":"SCM guile","40":"PERL6","41":"ERL","42":"CLPS","43":"ICK","44":"NICE","45":"PRLG","46":"ICON","47":"COB","48":"SCM chicken","49":"PIKE","50":"SCM qobi","51":"ST","52":"SQLQ","53":"NEM"},"max_timelimit":0.5,"source_sizelimit":50000,"problem_author":"daanish_adm","problem_tester":"","date_added":"30-08-2021","tags":{"0":"cakewalk","1":"daanish_adm","2":"sept21"},"problem_difficulty_level":"Cakewalk","best_tag":"","editorial_url":"https://discuss.codechef.com/problems/TRAVELPS","time":{"view_start_date":1631525400,"submit_start_date":1631525400,"visible_start_date":1631525400,"end_date":1735669800},"is_direct_submittable":false,"problemDiscussURL":"https://discuss.codechef.com/search?q=TRAVELPS","is_proctored":false,"visitedContests":{},"layout":"problem"}
---
### Read problem statements in [Bengali](https://www.codechef.com/download/translated/SEPT21/bengali/TRAVELPS.pdf), [Mandarin Chinese](https://www.codechef.com/download/translated/SEPT21/mandarin/TRAVELPS.pdf), [Russian](https://www.codechef.com/download/translated/SEPT21/russian/TRAVELPS.pdf), and [Vietnamese](https://www.codechef.com/download/translated/SEPT21/vietnamese/TRAVELPS.pdf) as well.

Chef is going on a road trip and needs to apply for inter-district and inter-state travel e-passes. It takes $A$ minutes to fill each inter-district e-pass application and $B$ minutes for each inter-state e-pass application.

His journey is given to you as a binary string $S$ of length $N$ where $0$ denotes crossing from one district to another district (which needs an inter-district e-pass), and a $1$ denotes crossing from one state to another (which needs an inter-state e-pass).

Find the total time Chef has to spend on filling the various forms.
<aside style='background: #f8f8f8;padding: 10px 15px;'><div>All submissions for this problem are available.</div></aside>