import std.stdio;
import std.functional;
import std.string;
import std.algorithm;

const C = 100000007;

long count(string s) {
    auto r = new long[s.length];
    r[$ - 1] = 1;
    for (long i = s.length - 2; i >= 0; i--) {
        if (s[i] == s[i + 1]) {
            r[i] = r[i + 1] + 1;
        } else {
            r[i] = 1;
        }
    }
    long[][] dp = new long[][](2, s.length + 1);
    void initDP(int d) {
        long[] cdp = dp[d == 3];
        long length = s.length;
        for (int i = 1; i <= min(d, length); i++) cdp[i] = 1;
        for (int i = 2; i <= length; i++) {
            for (int j = 1; j <= d; j++) {
                if (i - j >= 1) {
                    cdp[i] = (cdp[i] + cdp[i - j]) % C;
                }
            }
        }
    }
    initDP(3);
    initDP(5);
    int i = 0;
    long ans = 1;
    while (true) {
        if (i == s.length) break;
        long c = 0;
        int d = (s[i] == '0' || s[i] == '8') ? 3 : 5;
        for (long x = 0; x < r[i]; x += d) {
            c = (c + dp[d == 3][r[i] - x]) % C;
        }
        ans = ans * c % C;
        i += r[i];
    }
    return ans;
}

void main() {
    string s;
    while (s = stdin.readln.chomp, s != "#") {
        //writeln(s, " ", count(s));
        count(s).writeln;
    }
}