//************ || MD. SAJID ALAM CHOWDHURY || *************//
//**************** || 22-May-2021(Sat) || *****************//
//******************** || 18:40:18 || *********************//

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

//********************* || DEFINES || *********************//
#define BOOST               ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff                  first
#define ss                  second
#define IN                  insert
#define MP                  make_pair
#define PB                  push_back
#define PF                  push_front
#define LB                  lower_bound
#define UB                  upper_bound
#define NP                  next_permutation
#define PP                  prev_permutation
#define all(v)              v.begin(),v.end()
#define Fo(i,a,b)           for(i=a;i<=b;i++)
#define Fb(i,b,a)           for(i=b;i>=a;i--)

//******************** || TYPEDEFS || *********************//
typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

//******************** || CONSTANTS || ********************//
const ll MAX=2e5+5;
const ll MOD=1e9+7;
const ll INF=1e18+5;
const ld PI=acos(-1);

//******************** || FUNCTIONS || ********************//
ll gcd(ll m,ll n)
{
    while(n!=0)
    {
        m%=n;
        swap(m,n);
    }
    return m;
}
ll lcm(ll m,ll n)
{
    return ((m*n)/gcd(m,n));
}

ll perm(ll m,ll n)
{
    ll s=1,p=1;
    for(ll i=m+1;i<=(m+n);i++)
    {
        s*=i;
        s/=p;
        p++;
    }
    return s;
}

int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    
    /***********************/ BOOST /***********************/

    //***************** || READY TO GO || *****************//

    ll a,b,k,i,q,r,p,cnt=0,f;
    cin>>a>>b>>k;
    string str,ans;
    for(i=1;i<=a;i++)
    {
        str.PB('a');
    }
    for(i=1;i<=b;i++)
    {
        str.PB('b');
    }
    f=a+b;
    while(cnt!=f)
    {
        p=perm(a-1,b);
        if(k<=p)
        {
            ans.PB('a');
            a--;
        }
        else
        {
            ans.PB('b');
            k-=p;
            b--;
        }
        cnt++;
    }
    cout<<ans<<endl;
    return 0;
    
    //*************** || DONE AND DUSTED || ***************//
}
# include <bits/stdc++.h>

using namespace std;

int main(void) {
  int n;
  char s[5000];

  scanf("%d %s", &n, s);

  vector<int> a(n+1,0), t(n+1,0), c(n+1,0), g(n+1,0);

  for(int i=1;i<=n;i++) {
    a[i] = a[i-1];
    t[i] = t[i-1];
    c[i] = c[i-1];
    g[i] = g[i-1];

    if(s[i-1] == 'A') { a[i]++; }
    else if(s[i-1] == 'T') { t[i]++; }
    else if(s[i-1] == 'C') { c[i]++; }
    else if(s[i-1] == 'G') { g[i]++; }
  }

  long long int ans=0;
  for(int i=0;i<=n;i++) {
    for(int j=i-2;j>=0;j-=2) {

      if(a[i]-a[j] == t[i]-t[j] && c[i]-c[j] == g[i]-g[j]) { ans++; }
      /*
      if(a[i]>0 && t[i]>0 && a[i]-a[j] == t[i]-t[j]) { ans++; printf("%d %d\n", i, j); }
      else if(c[i]>0 && g[i]>0 && c[i]-c[j]>0 && c[i]-c[j] == g[i]-g[j]) { ans++; printf("%d %d\n", i, j); }
      else if(a[i]>0 && t[i]>0 && c[i]>0 && g[i]>0 && a[i]-a[j] == t[i]-t[j] && c[i]-c[j] == g[i]-g[j]) { ans++; printf("%d %d\n", i, j); }
      */
    }
  }


  cout << ans << endl;
  return 0;
}
