#include <iostream>
#include <vector>
#include <map>
using namespace std;

typedef vector <string> VS;

typedef long long ll;
const ll mod = 100000007;
bool visited[100001][10];
ll dp[100001];

typedef pair <int, int> PII;
map <PII, ll> memo;

VS cut( string s ) {
    VS answer;
    int L = s.size();
    string part = "";
    for ( int i = 0; i+1 < L; i++ ) {
        if ( s[i] != s[i+1] ) {
            part += s[i];
            answer.push_back(part);
            part = "";
        } else {
            part += s[i];
        }
    }
    part += s[L-1];
    answer.push_back(part);
    return answer;
}

ll solve( int s, int d ) {
    if ( visited[s][d] ) return memo[PII(s,d)];

    ll answer = 1;
    for ( int i = 0; i < s; i++ ) {
        dp[i] = 1;
    }
    for ( int i = 0; i < s; i++ ) {
        ll sum = 0;
        for ( int j = 1; j <= d && i-j >= 0; j++ ) {
            sum = ( sum + dp[i-j] ) % mod;
        }
        if ( sum > 0 ) dp[i] = ( dp[i] + sum ) % mod;
    }
    answer = dp[s-1];

    visited[s][d] = true;
    return memo[PII(s,d)] = answer % mod;
}

int conv( char c ) {
    if ( c == '8' || c == '0' ) return 3;
    return 5;
}

int main() {
    string input;
    while ( cin >> input ) {
        if ( input == "#" ) break;

        VS parts = cut( input );
        int L = parts.size();
        ll answer = 1;
        for ( int i = 0; i < L; i++ ) {
            answer = ( answer * solve(parts[i].size(), conv(parts[i][0])) ) % mod;
        }
        cout << answer << endl;
    }
    return 0;
}