#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


bool checkSubstring(string s){
    ll firstZeroP = -1;
    rep(i, s.size()){
        if(firstZeroP == -1){
            if(i == 0 && s[i] == '0'){
                firstZeroP = 0;
            }else if(i == 1 && s[i] == '0'){
                firstZeroP = 1;
            }else if(i == 2 && s[i] == '0'){
                firstZeroP = 2;
            }else if(i == 2 && s[i] == '1'){
                return false;
            }
            continue;
        }

        if(s[i] == '0'){
            if((i - firstZeroP) % 3 != 0){
                return false;
            }
        }else{
            if((i - firstZeroP) % 3 == 0){
                return false;
            }
        }
    }

    return true;
}

int main(){
    ll N;
    string T;
    cin >> N;
    cin >> T;

    if(T == "1"){
        cout << 20000000000 << endl;
        return 0;
    }
    
    if(!checkSubstring(T)){
        cout << 0 << endl;
    }else{
        ll countZero = 0;
        rep(i, T.size()){
            if(T[i] == '0'){
                countZero++;
            }
        }
        if(T[T.size() - 1] == '0'){
            cout << 10000000000 - countZero + 1 << endl;
        }else{
            cout << 10000000000 - countZero << endl;
        }
    }

    return 0;
}

#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

vector<int> po, ne;
int a, b;

int main(void) {
	scanf("%d %d", &a, &b);
	for (int i = 1; i <= a; i++) {
		po.push_back(i);
	}
	for (int i = 1; i <= b; i++) {
		ne.push_back(-i);
	}

	if (po.size() < ne.size()) {
		for (int i = po.size(); i < ne.size(); i++) {
			po[po.size() - 1] -= ne[i];
		}
	}
	else if (ne.size() < po.size()) {
		for (int i = ne.size(); i < po.size(); i++) {
			ne[ne.size() - 1] -= po[i];
		}
	}

	for (int e : ne) {
		printf("%d ", e);
	}
	for (int e : po) {
		printf("%d ", e);
	}
	puts("");
}