#include <bits/stdc++.h>
using namespace std;
int n;
string s;
vector<int> a;
long long check() {
  for (int i = 1; i < n; i++)
    if (!(abs(a[i] - a[i - 1]) <= 1)) return 0;
  return 1;
}
long long dp[1003][30];
int main() {
  memset(dp, 0, sizeof(dp));
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) a.push_back(s[i] - '0');
  for (int i = 0; i < 10; i++) dp[0][i] = 1;
  for (int i = 1; i < n; i++)
    for (int j = 0; j < 10; j++) {
      int a1 = j * 2 - 1, a2 = j * 2, a3 = j * 2 + 1;
      a1 -= a[i], a2 -= a[i], a3 -= a[i];
      if (a1 > -1) dp[i][j] += dp[i - 1][a1];
      if (a2 > -1) dp[i][j] += dp[i - 1][a2];
      if (a3 > -1) dp[i][j] += dp[i - 1][a3];
    }
  long long ans = 0;
  for (int i = 0; i < 10; i++) ans += dp[n - 1][i];
  ans -= check();
  cout << ans;
  return 0;
}
