#include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
//Do DEBUG OR NOT
//#define DEBUG

#ifdef DEBUG
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
#else 
#define debug(...) true
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

//prototype declaration
ll pow_mod(ll n, ll k, ll m);//繰り返し二乗法 return val:(n^k)%m
ll gcd(ll a, ll b);//最大公約数 2引数
ll ngcd(vector<ll> a);
ll lcm(ll a, ll b);//最小公倍数 2引数
ll nlcm(vector<ll> numbers);
bool isPrime(ll x);//素数判定
ll digsum(ll n);//桁和
vector<ll> enum_div(ll n);//約数全列挙
int stringcount(string s, char c);//特定文字カウント


//__________________________main__________________________

int main(){
    int n;
    cin>>n;
    vector<ll> A;
    vector<ll> Asq;
    rep(i,n){
        ll x;
        cin>>x;
        A.emplace_back(x);
        Asq.emplace_back(x*x);
    }

    //AiAj
    ll Sumline=accumulate(A.begin(),A.end(),0)-A[0];
    debug(Sumline);
    ll sumAB=0;
    for(ll j=0;j<n-1;j++){
        if(j!=0) Sumline-=A[j];
        debug(j);
        debug(A[j]);
        debug(Sumline);
        sumAB+=A[j]*Sumline;
        debug(sumAB);
    }
    debug(sumAB);

    //Ai*Ai
    ll Asqi=0;
    debug(Asq);
    int len=Asq.size()-1;
    for(ll i=1;i<n;i++){
        debug(i);
        debug(Asq[i]);
        Asqi+=Asq[i]*i;
        debug(Asqi);
    }
    debug(Asqi);

    //Aj*Aj
    ll Asqj=0;
    len=Asq.size()-1;
    for(ll i=0;i<n-1;i++){
        debug(i);
        debug(Asq[i]);
        Asqj+=Asq[i]*len;
        len--;
    }
    debug(Asqj);

    cout<<Asqi+Asqj-(2*sumAB)<<endl;
    return 0;
}


//__________________________functions_____________Ctrl+K,Ctrl+0
//繰り返し二乗法関数
ll pow_mod(ll n, ll k, ll m){//r:(n^k)%m
    ll r=1;
    for(;k>0;k=k>>1){
        if(k&1) r=(r*n)%m;
        n = (n*n) % m;
    }
    return r;
}
//最大公約数 2引数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}
//最大公約数 n引数
ll ngcd(vector<ll> a){
    ll res;
    res = a[0];
    for(int i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}
//最小公倍数 2引数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
//最小公倍数 n引数
ll nlcm(vector<ll> numbers) {
    ll res;
    res = numbers[0];
    for (int i = 1; i < numbers.size(); i++) {
        res = lcm(res, numbers[i]);
    }
    return res;
}
//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}
//桁和
ll digsum(ll n) {
    ll res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}
//約数全列挙
vector<ll> enum_div(ll n){
    vector<ll> ret;
    for(int i = 1 ; i*i <= n ; ++i){
        if(n%i == 0){
            ret.push_back(i);
            if(i != 1 && i*i != n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}
//特定文字カウント
int stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
#define all(v) v.begin(), v.end()
const int INF = 1<<30;
const long long LINF = 1LL << 60;
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
using PLI = pair<long long,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    cin.tie(nullptr) ;
    ios::sync_with_stdio(false) ;

    ll n, x;
    string s;
    cin >> n >> x >> s;
    ll res = x;
    rep(i,n){
        if (s[i] == 'o') res++;
        else
            res = max(res - 1, 0LL);
    }
    cout << res << "\n";
    return 0;
}