#include using namespace std; typedef long long ll; typedef long double ld; typedef pair ii; typedef vector vi; typedef vector vvi; typedef vector vii; #define x first #define y second #define pb push_back #define eb emplace_back #define all(v) (v).begin(), (v).end() const ld PI = acos((ld) -1); const ll INFTY = 1'000'000'000'000; void run() { ll a, b, c; cin >> a >> b >> c; string w, p; cin >> w >> p; for (ll i = 0; i < w.size(); i++) { ll res = 0; ll last = -INFTY; for (ll j = 0; j < p.size(); j++) { if (p[j] == w[i]) { res += b + min(a*(j-last-1), 2*c); last = j; } } cout << res << endl; } } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); run(); return 0; }