#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    long long c1, c2;
    string s;
    cin >> c1 >> c2 >> s;
    
    int n = s.size();
    
    // Problem: Split string into pieces to minimize cost
    // Cost = (adjacent equal pairs) * c1 + (number of splits) * c2
    
    // pre[i] = number of adjacent equal pairs in s[0..i-1]
    // Prefix sum of pairs (s[0],s[1]), (s[1],s[2]), ..., (s[i-2],s[i-1])
    vector<int> pre(n + 1, 0);
    for (int i = 1; i < n; i++) {
        pre[i + 1] = pre[i];
        if (s[i - 1] == s[i]) {
            pre[i + 1]++;
        }
    }
    
    // dp[i] = min cost to optimally split s[0..i-1]
    const long long INF = 1e18;
    vector<long long> dp(n + 1, INF);
    dp[0] = 0;  // empty string has cost 0
    
    // For each position i, try all possible ways to form the last piece
    for (int i = 1; i <= n; i++) {
        // Try making last piece from s[j..i-1]
        for (int j = 0; j < i; j++) {
            // Count adjacent equal pairs in substring s[j..i-1]
            // Pairs are: (s[j],s[j+1]), (s[j+1],s[j+2]), ..., (s[i-2],s[i-1])
            // These correspond to indices j+1, j+2, ..., i-1 in the prefix array
            int cnt = pre[i] - pre[j + 1];
            
            // Cost of pairs in this piece
            long long cost = (long long)cnt * c1;
            
            // Add split cost (c2) if this isn't the first piece
            if (j > 0) cost += c2;
            
            // Update minimum cost to reach position i
            dp[i] = min(dp[i], dp[j] + cost);
        }
    }
    
    cout << dp[n] << "\n";
    
    return 0;
}