#include <set>
#include <iostream>
#include <cstdio>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;

int cnt[10] = {
  3, 5, 5, 5, 5, 5, 5, 5, 3, 5
};

int dp[10][100 * 1000 + 1];
char buff[100* 1000 + 10];
const int mod = 100000007;

int main(){
  REP(i,10){
    dp[i][0] = 1;
    REP(j,100 * 1000 + 1){
      dp[i][j+1] = dp[i][j] * 2;
      if(j + 1 > cnt[i]) dp[i][j+1] += mod - dp[i][j-cnt[i]];
      dp[i][j+1] %= mod;
    }
  }

  while(scanf("%s", buff), buff[0] != '#'){
    long long ans = 1;
    int i = 0;
    while(isdigit(buff[i])){
      char now = buff[i]; 
      int cc = 0;
      while(buff[i] == now){ cc++; i++; }
      // printf("cc: %d now: %c\n", cc, now);
      ans = (ans * dp[now - '0'][cc - 1]) % mod;
    }
    cout << ans << endl;
  }

  return 0;
}