#include <bits/stdc++.h>
using namespace std;
int s[55];
int sz;
long long dp[55][55];
string a;
int ab(int y) {
  if (y < 0) return -y;
  return y;
}
int bal(int prev_base, int pos) {
  if (pos == sz + 1) {
    return 1;
  }
  long long& res = dp[prev_base][pos];
  if (res != -1) return res;
  if ((prev_base + s[pos]) % 2 == 1)
    return res = (bal((prev_base + s[pos]) / 2, pos + 1) +
                  bal(((prev_base + s[pos]) / 2) + 1, pos + 1));
  else
    return res = bal((prev_base + s[pos]) / 2, pos + 1);
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> a;
  int flag = 1;
  long long ans = 0;
  sz = a.size();
  for (int i = 0; i < a.size(); ++i) s[i + 1] = a[i] - '0';
  for (int i = 1; i < sz; i++)
    if ((ab(s[i + 1] - s[i]) != 1) && (ab(s[i + 1] - s[i]) != 0)) flag = 0;
  if (sz == 1) {
    cout << 9 << endl;
    return 0;
  }
  for (int i = 0; i < 10; i++) {
    ans += bal(i, 2);
  }
  if (flag)
    cout << ans - 1 << endl;
  else
    cout << ans << endl;
}
