#include <bits/stdc++.h>
using namespace std;
const int N = 51;
long long f[N][10], ans = 0;
long long num[N];
char c[N];
bool tag;
long long n;
long long dfs(int now, int x) {
  if (now > n) return 1;
  if (f[now][x] != -1) return f[now][x];
  if ((num[now] + x) % 2 == 0)
    return f[now][x] = dfs(now + 1, (num[now] + x) / 2);
  else
    return f[now][x] = dfs(now + 1, (num[now] + x) / 2) +
                       dfs(now + 1, (num[now] + x + 1) / 2);
}
int main() {
  long long i, j, k;
  cin >> c + 1;
  n = strlen(c + 1);
  memset(f, -1, sizeof(f));
  for (i = 1; i <= n; i++) num[i] = c[i] - '0';
  for (i = 0; i <= 9; i++) ans += dfs(2, i);
  tag = true;
  for (i = 2; i <= n; i++)
    if (num[i] != (num[i - 1] + num[i]) / 2 &&
        num[i] != (num[i - 1] + num[i] + 1) / 2)
      tag = false;
  if (tag)
    cout << ans - 1;
  else
    cout << ans;
  return 0;
}
