import std.stdio;
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 g(long i) {
        if (i == s.length) return 1;
        long d = (s[i] == '0' || s[i] == '8') ? 3 : 5;
        long ans = 0;
        for (long x = 1; x <= min(d, r[i]); x++) {
            if (x == r[i]) ans = (ans + 1) % C;
            else           ans = (ans + g(i + x)) % C;
        }
        return ans;
    }
    long f(long i) {
        if (i == s.length) return 1;
        long c = 0;
        long d = (s[i] == '0' || s[i] == '8') ? 3 : 5;
        for (long x = 0; x < r[i]; x += d) {
            //writeln("call: ", i, " ", x);
            c = (c + g(i + x)) % C;
        }
        long ans = c * f(i + r[i]) % C;
        return ans;
    }
    return f(0);
}

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