#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
#define M 100000007
#define N 100000

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

char str[N+1];
int dp1[N+1], dp2[N+1];

int main(){
  dp1[1] = 1; dp1[2] = 2; dp1[3] = 4; dp1[4] = 8; dp1[5] = 16;
  REP(i, 6, N+1){
    dp1[i] = 1;
    REP(j, 1, 6) dp1[i] = (dp1[i] + dp1[i-j])%M;
  }

  dp2[1] = 1; dp2[2] = 2; dp2[3] = 4;
  REP(i, 4, N+2){
    dp2[i] = 1;
   REP(j, 1, 4) dp2[i] = (dp2[i] + dp2[i-j])%M;
  }

  while(scanf("%s", str) && str[0] != '#'){
    int c = 0;
    ll res = 1;
    char now = str[0];
    rep(i, strlen(str)){
      if(str[i] == now) c++;
      else{
	//	printf("%d\n", c);
	if(now == '1' || now == '2' || now == '3' || now == '4' || now == '5' || now == '6' || 
	   now == '7' || now == '9') res = (res * dp1[c])%M;
	else res = (res * dp2[c])%M;
	c = 1;
	now = str[i];
      }
    }
    //    printf("%d\n", c);
    if(now == '8' || now == '0') res = (res * dp2[c])%M;
    else res = (res * dp1[c])%M;

    printf("%lld\n", res);
  }
  return 0;
}