#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>

using namespace std;

int main(){
	const int MOD = 100000007;
	int dpA[100001], dpB[100001];
	memset(dpA, 0, sizeof(dpA));
	memset(dpB, 0, sizeof(dpB));
	dpA[0] = 1, dpB[0] = 1;
	for(int i=0;i<=100000;i++){
		for(int j=1;j<=5;j++)
			if(i+j<=100000)
				dpA[i+j] = (dpA[i+j]+dpA[i])%MOD;
	}
	for(int i=0;i<=100000;i++){
		for(int j=1;j<=3;j++)
			if(i+j<=100000)
				dpB[i+j] = (dpB[i+j]+dpB[i])%MOD;
	}
	int sumA[100001], sumB[100001];
	memset(sumA, 0, sizeof(sumA));
	memset(sumB, 0, sizeof(sumB));
	for(int i=0;i<=100000;i++){
		sumA[i] = dpA[i];
		if(i-5>0) sumA[i] = (sumA[i]+sumA[i-5])%MOD;
	}
	for(int i=0;i<=100000;i++){
		sumB[i] = dpB[i];
		if(i-3>0) sumB[i] = (sumB[i]+sumB[i-3])%MOD;
	}
	string str;
	while(cin >> str){
		if(str=="#") break;
		int idx = 0;
		long long res = 1;
		while(idx < str.size()){
			int cur = str[idx]-'0';
			int cnt = 0;
			while(idx < str.size() && str[idx]-'0' == cur) cnt++, idx++;
			if(cur == 0 || cur == 8)
				res = (res*sumB[cnt])%MOD;
			else
				res = (res*sumA[cnt])%MOD;
		}
		cout << res << endl;
	}
}