This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at least one more time, but the losestreak only grew longer and longer... It's no wonder he didn't get any sleep this night at all.

In the morning, Vasya was waiting the bus to the university on the bus stop. Vasya's thoughts were hazy and so he couldn't remember the right bus' number quite right and got onto the bus with the number n.

In the bus, Vasya thought that he could get the order of the digits in the number of the bus wrong. Futhermore, he could "see" some digits several times, but the digits he saw were definitely in the real number of the bus. For example, if Vasya saw the number 2028, it could mean that the real bus number could be 2028, 8022, 2820 or just 820. However, numbers 80, 22208, 52 definitely couldn't be the number of the bus. Also, real bus number couldn't start with the digit 0, this meaning that, for example, number 082 couldn't be the real bus number too.

Given n, determine the total number of possible bus number variants.

Input

The first line contains one integer n (1 ≤ n ≤ 10^{18}) — the number of the bus that was seen by Vasya. It is guaranteed that this number does not start with 0.

Output

Output a single integer — the amount of possible variants of the real bus number.

Examples

Input

97


Output

2


Input

2028


Output

13

Note

In the first sample, only variants 97 and 79 are possible.

In the second sample, the variants (in the increasing order) are the following: 208, 280, 802, 820, 2028, 2082, 2208, 2280, 2802, 2820, 8022, 8202, 8220.
//package cf491;

import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.stream.Collectors;

// What's the smallest input?
// Check * for int/long overflow.
// Check / for accidental rounding.
// Are you using doubles? Can you avoid it?
// Never compare after taking mod.
// Mod the final result.
// Initialize globals in solve() unless they are independent of the problem input.
// Check for local/global name conflicts (n?).
// Check initial values for max/min (not Integer.MIN_VALUE for long).
public class E {
    static Random rand;
    static boolean CONSTRUCTIVE = false;
    static long MOD = (long) 1e9 + 7;
    static long BIG = (long) 2e9;

    public static void solve(Reader in, PrintWriter out) {
        char[] n = in.next().toCharArray();

        int[] arr = new int[10];
        for (char c : n) {
            arr[c-'0']++;
        }
        int start = 9;
        while (arr[start] == 0) {
            start--;
        }

        long[][] dp = new long[11][n.length+1];
        for (int i = 1; i <= arr[start]; i++) {
            dp[start][i] = 1;
        }

        for (int i = start-1; i >= 0; i--) {
            int count = arr[i];
            if (count == 0) {
                dp[i] = Arrays.copyOf(dp[i+1], n.length+1);
            }
            for (int num = 1; num <= count; num++) {
                for (int length = 1; length < n.length; length++) {
                    if (dp[i+1][length] > 0) {
                        long balls = num;
                        long bins = i == 0 ? length : length + 1;

                        long ways = dp[i+1][length] * binom(balls + bins - 1, balls);
                        dp[i][length+num] += ways;
                    }
                }
            }
        }
        long count = 0;
        for (int i = 0; i < dp[0].length; i++) {
            count += dp[0][i];
        }
        out.println(count);
    }

    static long binom(long n, long k) {
        if (k == 0) return 1;
        if (k == 1) return n;

        long result = 1;
        for (int i = 0; i < k; i++) {
            result *= n - i;
            result /= i + 1;
        }
        return result;
    }

    public static void main(String[] args) throws IOException {
        Reader in = null;
        PrintWriter out = null;
        for (String arg : args) {
            if (arg.startsWith("input")) {
                in = new Reader(arg);
            } else if (arg.startsWith("output")) {
                out = new PrintWriter(new FileWriter(arg));
            }
        }
        if (in == null) in = new Reader();
        if (out == null) out = new PrintWriter(new OutputStreamWriter(System.out));

//        int tests = in.nextInt();
//        for (int t = 0; t < tests; t++) {
            solve(in, out);
//        }

        out.flush();
    }

    static class Tester {
        public static void main(String[] args) throws IOException {
            Validator validator = new Validator();

            File currentDir = new File(".");
            long before;
            long after;
            for (File inputFile : Arrays.stream(currentDir.listFiles())
                    .sorted(Comparator.comparing(File::getName))
                    .collect(Collectors.toList())) {
                if (!inputFile.getName().startsWith("input")
                        || inputFile.getName().contains("sight")
                        || inputFile.getName().contains("big")) continue;
                System.out.println("Test file: " + inputFile.getName());

                before = System.nanoTime();
                String outputFileName = "output" + inputFile.getName().substring(5);
                E.main(new String[]{inputFile.getName(), outputFileName});
                after = System.nanoTime();

                File outputFile = new File(outputFileName);
                if (!outputFile.exists()) {
                    throw new IllegalStateException("Missing output file " + outputFile);
                }

                // TODO if verifier is implemented, remove this
                if (CONSTRUCTIVE) {
                    System.out.println("INPUT:");
                    printFile(inputFile);
                    System.out.printf("\nOUTPUT: (%d milliseconds)\n", (after - before) / 1000000L);
                    printFile(outputFile);
                    continue;
                }

                if (validator.validate(inputFile, outputFile)) {
                    System.out.printf("OK (%d milliseconds)\n", (after - before) / 1000000L);
                } else {
                    System.out.println("FAILED");
                    System.out.println("\nInput: ");
                    printFile(inputFile);
                    System.out.println("\nIncorrect Output: ");
                    printFile(outputFile);
                    return;
                }
            }
            System.out.println("\n-----------------\n");

            File sightTestInput = new File("input-sight");
            if (sightTestInput.exists()) {
                System.out.println("Running sight test... Input:");
                printFile(sightTestInput);
                before = System.nanoTime();
                System.out.println("\nOutput: ");
                E.main(new String[]{"input-sight"});
                after = System.nanoTime();
                System.out.printf("(%d milliseconds)\n", (after - before) / 1000000L);
                System.out.println("\n-----------------\n");
            }

            File bigTestInput = new File("input-big");
            if (bigTestInput.exists()) {
                System.out.println("Running big test...");
                before = System.nanoTime();
                E.main(new String[] {"input-big"});
                after = System.nanoTime();
                System.out.printf("(%d milliseconds)\n", (after - before) / 1000000L);
            }
        }

        static void printFile(File file) throws FileNotFoundException {
            BufferedReader reader = new BufferedReader(new FileReader(file));
            reader.lines().forEach(System.out::println);
        }
    }

    static class Validator {
        boolean validate(File inputFile, File outputFile) throws IOException {
            File expectedOutputFile = new File("expected-output" + inputFile.getName().substring(5));
            if (CONSTRUCTIVE || !expectedOutputFile.exists()) {
                return validateManual(inputFile, outputFile);
            }
            return areSame(outputFile, expectedOutputFile);
        }

        private boolean validateManual(File inputFile, File outputFile) throws IOException {
            if (CONSTRUCTIVE) {
                // Validate output against input
                Reader inputReader = new Reader(inputFile.getName());
                Reader outputReader = new Reader(outputFile.getName());

                // TODO implement manual validation

                throw new IllegalStateException("Missing expected output file");
            } else {
                File naiveOutput = new File("naive-" + outputFile.getName());
                Naive.main(new String[]{inputFile.getName(), naiveOutput.getName()});

                return areSame(outputFile, naiveOutput);
            }
        }

        private boolean areSame(File file1, File file2) throws IOException {
            BufferedReader reader1 = new BufferedReader(new FileReader(file1));
            BufferedReader reader2 = new BufferedReader(new FileReader(file2));

            String line1;
            while ((line1 = reader1.readLine()) != null) {
                String line2 = reader2.readLine();
                if (line2 == null) line2 = ""; // ok if one has an extra newline
                if (!line1.trim().equals(line2.trim())) {
                    return false;
                }
            }
            String line2;
            while ((line2 = reader2.readLine()) != null) {
                if (!line2.trim().isEmpty()) {
                    return false;
                }
            }
            return true;
        }

    }

    static class Naive {
        public static void solveNaive(Reader in, PrintWriter out) {
            throw new IllegalStateException("missing expected output file");
        }

        public static void main(String[] args) throws IOException {
            Reader in = null;
            PrintWriter out = null;
            for (String arg : args) {
                if (arg.startsWith("input")) {
                    in = new Reader(arg);
                } else if (arg.startsWith("naive-output")) {
                    out = new PrintWriter(new FileWriter(arg));
                }
            }
            if (in == null) in = new Reader();
            if (out == null) out = new PrintWriter(new OutputStreamWriter(System.out));

            int tests = in.nextInt();
            for (int t = 0; t < tests; t++) {
                solveNaive(in, out);
            }

            out.flush();
            out.close();
        }
    }

    static long pair(int x, int y) {
        return x * BIG + y;
    }

    static int x(long pair) {
        return (int) (pair / BIG);
    }

    static int y(long pair) {
        return (int) (pair % BIG);
    }

    static void ruffleSort(int[] a) {
        if (rand == null) rand = new Random();
        int n=a.length;
        for (int i=0; i<n; i++) {
            int oi=rand.nextInt(n), temp=a[oi];
            a[oi]=a[i]; a[i]=temp;
        }
        Arrays.sort(a);
    }

    static void insist(boolean bool) {
        if (!bool) throw new IllegalStateException();
    }

    static class Reader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public Reader() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        public Reader(String fileName) throws FileNotFoundException {
            reader = new BufferedReader(new FileReader(fileName));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int[] nextInts(int n) {
            int[] out = new int[n];
            for (int i = 0; i < n; i++) {
                out[i] = nextInt();
            }
            return out;
        }

        public long[] nextLongs(int n) {
            long[] out = new long[n];
            for (int i = 0; i < n; i++) {
                out[i] = nextLong();
            }
            return out;
        }
    }
}
