#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define debug(x) {cerr<<#x<<" = "<<(x)<<endl;}

ll ksm(ll a,ll k,ll p)
{
    ll ans=1;
    while(k)
    {
        if(k&1) ans=ans*a%p;
        k>>=1;
        a=a*a%p;
    }
    return ans;
}
int sz[10][4] = {
        {0,0,0,0},
        {1,1,1,1},
        {6,2,4,8},
        {1,3,9,7},
        {6,4,6,4},
        {5,5,5,5},
        {6,6,6,6},
        {1,7,9,3},
        {6,8,4,2},
        {1,9,1,9}
};
int main()
{
    ios::sync_with_stdio(false);
    ll a,b,c; cin>>a>>b>>c;
    cout<<sz[a%10][ksm(b,c,4)];
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ll n, x;
    string s;
    cin >> n >> x >> s;

    for (int i = 0; i < n; i++)
    {
        if (x > 0 && s[i] == 'x')
            x--;
        else if (s[i] == 'o')
            x++;
    }

    cout << x << endl;
}