#include <bits/stdc++.h>

const int N = 300005, mod = 1000000007;

const std::vector<int> trans[2] = {
	{1, 2, 1, 4, 5, 4, 6, },
	{3, 0, 1, 6, 3, 4, 6, },
};

void reduce(int &x) { x += x >> 31 & mod; }

int dp[7], g[7];

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::string s; std::cin >> s, dp[0] = 1;
	for (char ch : s) {
		for (int i = 0; i < 7; ++i) g[i] = 0;
		for (int i = 0; i < 7; ++i) {
			if (ch != '1') reduce(g[trans[0][i]] += dp[i] - mod);
			if (ch != '0') reduce(g[trans[1][i]] += dp[i] - mod);
		}
		for (int i = 0; i < 7; ++i) dp[i] = g[i];
	}
	std::cout << (dp[3] + dp[6]) % mod;
	return 0;
}