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


const int mod = 100000007;
struct Mod {
public:
	int num;
	Mod() : Mod(0) { ; }
	Mod(long long int n) : num((n % mod + mod) % mod) {
		static_assert(mod<INT_MAX / 2, "mod is too big, please make num 'long long int' from 'int'");
	}
	Mod(int n) : Mod(static_cast<long long int>(n)) { ; }
	operator int() { return num; }
};

Mod operator+(const Mod a, const Mod b) { return Mod((a.num + b.num) % mod); }
Mod operator+(const long long int a, const Mod b) { return Mod(a) + b; }
Mod operator+(const Mod a, const long long int  b) { return b + a; }
Mod operator++(Mod &a) { return a + Mod(1); }
Mod operator-(const Mod a, const Mod b) { return Mod((mod + a.num - b.num) % mod); }
Mod operator-(const long long int a, const Mod b) { return Mod(a) - b; }
Mod operator--(Mod &a) { return a - Mod(1); }
Mod operator*(const Mod a, const Mod b) { return Mod(((long long)a.num * b.num) % mod); }
Mod operator*(const long long int a, const Mod b) { return Mod(a)*b; }
Mod operator*(const Mod a, const long long int b) { return Mod(b)*a; }
Mod operator*(const Mod a, const int b) { return Mod(b)*a; }
Mod operator+=(Mod &a, const Mod b) { return a = a + b; }
Mod operator+=(long long int &a, const Mod b) { return a = a + b; }
Mod operator-=(Mod &a, const Mod b) { return a = a - b; }
Mod operator-=(long long int &a, const Mod b) { return a = a - b; }
Mod operator*=(Mod &a, const Mod b) { return a = a * b; }
Mod operator*=(long long int &a, const Mod b) { return a = a * b; }
Mod operator*=(Mod& a, const long long int &b) { return a = a * b; }
Mod operator^(const Mod a, const int n) {
	if (n == 0) return Mod(1);
	Mod res = (a * a) ^ (n / 2);
	if (n % 2) res = res * a;
	return res;
}
Mod mod_pow(const Mod a, const long long  int n) {
	if (n == 0) return Mod(1);
	Mod res = mod_pow((a * a), (n / 2));
	if (n % 2) res = res * a;
	return res;
}
Mod inv(const Mod a) { return a ^ (mod - 2); }
Mod operator/(const Mod a, const Mod b) {
	assert(b.num != 0);
	return a * inv(b);
}
Mod operator/(const long long int a, const Mod b) {
	return Mod(a) / b;
}
Mod operator/=(Mod &a, const Mod b) {
	return a = a / b;
}

#define MAX_MOD_N 1024000

Mod fact[MAX_MOD_N], factinv[MAX_MOD_N];
void init(const int amax = MAX_MOD_N) {
	fact[0] = Mod(1); factinv[0] = 1;
	for (int i = 0; i < amax - 1; ++i) {
		fact[i + 1] = fact[i] * Mod(i + 1);
		factinv[i + 1] = factinv[i] / Mod(i + 1);
	}
}
Mod comb(const int a, const int b) {
	return fact[a] * factinv[b] * factinv[a - b];
}

int main() {
	vector<vector<Mod>>dp5(2e5, vector<Mod>(5));
	dp5[1][0] = 1;
	for (int i = 1; i < 1e5 + 3; ++i) {
		for (int j = 0; j < 5; ++j) {
			dp5[i + 1][0] += dp5[i][j];
			if (j != 4) {
				dp5[i + 1][j + 1] += dp5[i][j];
			}
		}
	}
	vector<vector<Mod>>dp3(2e5, vector<Mod>(3));
	dp3[1][0] = 1;
	for (int i = 1; i < 1e5 + 3; ++i) {
		for (int j = 0; j < 3; ++j) {
			dp3[i + 1][0] += dp3[i][j];
			if (j != 2) {
				dp3[i + 1][j + 1] += dp3[i][j];
			}
		}
	}
	vector<Mod>sums3(2e5), sums5(2e5);
	sums3[0] = 0;
	sums5[0] = 0;
	for (int i = 0; i < 1e5 + 3; ++i) {
		for (int j = 0; j < 3; ++j) {
			sums3[i] += dp3[i][j];
		}
		for (int j = 0; j < 5; ++j) {
			sums5[i] += dp5[i][j];
		}
		if (i >= 3)sums3[i + 1] += sums3[i - 2];
		if (i >= 5)sums5[i + 1] += sums5[i - 4];
	}
	while (1) {
		string st; cin >> st;
		if (st == "#")break;
		else {
			vector<pair<int,int>>nums;
			char pre = ' ';
			int num = 0;
			for (int i = 0; i < st.size(); ++i) {
				char c(st[i]);
				if (!num || (pre == c)) {
					num++;
				}
				else {
					
					nums.emplace_back(pre,num);
					num = 1;
				}
				pre = c;
			}
			nums.emplace_back(pre,num);
			Mod ans = 1;
			for (auto n : nums) {
				if (n.first == '0' || n.first == '8') {
					ans *= sums3[n.second];
				}
				else {
					ans *= sums5[n.second];
				}
			}
			cout << ans << endl;
			
		}
	}

	
	return 0;
}

Measured memory_bytes: 34592