#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const double pi = acos(-1);
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int power(long long int a, long long int b, long long int p) {
  if (b == 0) return 1;
  long long int c = power(a, b / 2, p);
  if (b % 2 == 0)
    return (c * c) % p;
  else
    return (((c * c) % p) * a) % p;
}
long long int inv(long long int n, long long int p) {
  return power(n, p - 2, p);
}
bool isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, copy;
  cin >> s;
  copy = s;
  long long int dp[50][10];
  memset((dp), 0, sizeof((dp)));
  for (long long int i = 0; i < 10; i++) dp[0][i] = 1;
  int sz = ((long long int)(s).size()), flag = 1;
  for (long long int i = 1; i < sz; i++) {
    int num = s[i] - '0';
    int pnum = copy[i - 1] - '0';
    int sum = num + pnum;
    if (sum % 2) {
      if (sum / 2 == num)
        copy[i] = num + '0';
      else if (sum / 2 + 1 == num)
        copy[i] = num + '0';
      else
        flag = 0;
    } else if (sum / 2 != num)
      flag = 0;
    for (long long int j = 0; j < 10; j++) {
      int l = (num + j) / 2, r = (num + j + 1) / 2;
      dp[i][l] += dp[i - 1][j];
      if (l != r) dp[i][r] += dp[i - 1][j];
    }
  }
  long long int ans = 0;
  for (long long int i = 0; i < 10; i++) ans += dp[sz - 1][i];
  cout << ans - flag << '\n';
  return 0;
}
