#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, d, e, f, g, h, i;
  cin >> n;
  a = n % 10;
  b = n % 100;
  c = n % 1000;
  d = n % 10000;
  e = n % 100000;
  f = n % 1000000;
  g = n % 10000000;
  h = n % 100000000;
  i = n % 1000000000;
  if (a < 3) a = 0;
  if (3 <= a < 5) a = 1;
  if (5 <= a < 7) a = 2;
  if (7 <= a) a = 3;
  if (b < 3) b = 0;
  if (3 <= b < 5) b = 1;
  if (5 <= b < 7) b = 2;
  if (7 <= b) b = 3;
  if (c < 3) c = 0;
  if (3 <= c < 5) c = 1;
  if (5 <= c < 7) c = 2;
  if (7 <= c) c = 3;
  if (d < 3) d = 0;
  if (3 <= d < 5) d = 1;
  if (5 <= d < 7) d = 2;
  if (7 <= d) d = 3;
  if (e < 3) e = 0;
  if (3 <= e < 5) e = 1;
  if (5 <= e < 7) e = 2;
  if (7 <= e) e = 3;
  if (f < 3) f = 0;
  if (3 <= f < 5) f = 1;
  if (5 <= f < 7) f = 2;
  if (7 <= f) f = 3;
  if (g < 3) g = 0;
  if (3 <= g < 5) g = 1;
  if (5 <= g < 7) g = 2;
  if (7 <= g) g = 3;
  if (h < 3) h = 0;
  if (3 <= h < 5) h = 1;
  if (5 <= h < 7) h = 2;
  if (7 <= h) h = 3;
  if (i < 3) i = 0;
  if (3 <= i < 5) i = 1;
  if (5 <= i < 7) i = 2;
  if (7 <= i) i = 3;
  int ans;
  ans = a + a * b + a * b * c + a * b * c * d * e + a * b * c * d * e * f +
        a * b * c * d * e * f * g + a * b * c * d * e * f * g * h +
        a * b * c * d * e * f * g * h * i;
  cout << ans << endl;
}
