// arc110_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (ll)(1e9)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int idx=0;idx<(n-1);idx++) cout << (vec)[idx] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << "\n";}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    string T;
    cin >> N >> T;

    string s = "110";
    ll ans = 0;
    REP(k, 3){

        bool same = true;
        REP(i, N){
            if (s[(i + k)%3] != T[i]){
                same = false;
                break;
            }
        }

        if (same){
            ans += (ll)1e10 - (k+N+2)/3 + 1;
        }
    }

    print(ans);


    return 0;
}

#include<bits/stdc++.h>
#define f first
#define int long long
#define s second
using namespace std;
const int N=2e5+5,mod=1e9+7;
int t,n,a,b;
string s;
 main(){
	// t=1;
	cin>>a>>b;
	if(a>=b) {
		int sum=0;
		for(int i=1;i<=a;i++){
			cout<<i<<" ";
			if(i>=b) sum -= i;
		}
		 for(int i=1;i<=b;i++) {
			if(i<b) cout<<-i<<" ";
			else cout<<sum;
		}
	}
	else if(a<b) {
		swap(a,b);
		int sum=0;
		for(int i=1;i<=a;i++){
			cout<<-i<<" ";
			if(i>=b) sum += i;
		}
		 for(int i=1;i<=b;i++) {
			if(i<b) cout<<i<<" ";
			else cout<<sum;
		}		
	}
}
