#include <bits/stdc++.h>
using namespace std;
char pn[51];
long long dp[51][10];
int n;
bool check() {
  for (int i = 0; i < n - 1; i++)
    if (((pn[i] + pn[i + 1]) >> 1) == pn[i + 1] ||
        ((pn[i] + pn[i + 1] + 1) >> 1) == pn[i + 1])
      continue;
    else
      return false;
  return true;
}
int main() {
  scanf("%s", pn);
  n = strlen(pn);
  for (int i = 0; i < n; i++) pn[i] -= '0';
  for (int i = 0; i <= 9; i++) dp[0][i] = 1;
  for (int i = 1; i < n; i++) {
    fill(dp[i], dp[i] + 10, 0);
    for (int j = 0; j <= 9; j++) {
      dp[i][(j + pn[i]) >> 1] += dp[i - 1][j];
      if ((j + pn[i]) & 1) {
        dp[i][((j + pn[i]) >> 1) + 1] += dp[i - 1][j];
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i <= 9; i++) ans += dp[n - 1][i];
  if (check()) ans--;
  cout << ans << endl;
}
