#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;
typedef long long ll;
int M = 100000007;

int table[10] = {3,5,5,5,5,5,5,5,3,5};
int dp[10][100001][6];

ll solve(int button, int len) {
  ll res = 0;
//  cout << button << " " << len << endl;
  REP(i, table[button]) {
    res = (res + dp[button][len][i]) % M;
  }
  return res;
}

int main() {
  memset(dp,0,sizeof(dp));
  REP(i, 10) {
    //dp[i][0][0] = 1;
    for (int j=1; j<100001; ++j) {
      if (j%table[i]==1) dp[i][j][0] = 1;
      REP(k, table[i])
        dp[i][j][0] = (dp[i][j][0] + dp[i][j-1][k]) % M;
      for (int k=1; k<table[i]; ++k) {
        dp[i][j][k] = (dp[i][j][k] + dp[i][j-1][k-1]) % M;
      }
    }
  }
  // REP(i,10) {
  //   REP(j,5) {
  //     printf("(%d,%d)=%d ", i,j,dp[1][i][j]);
  //   }
  //   cout <<endl;
  // }
  // cout << endl;
  
  string s;

  while(cin >> s, s!="#") {
    char now = 0;
    int start = 0;
    ll res = 1;
    REP(i, s.size()) {
      if (s[i] != now) {
        if (now!=0) {
          res = (res * solve(now-'0', i-start)) % M;
        }
        now = s[i];
        start = i;
      }
    }
    res = (res * solve(now-'0', s.size()-start)) % M;
    cout << res << endl;
  }
}