using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Numerics; namespace foryuki { class Program { static void Main(string[] args) { char[] c = Console.ReadLine().ToCharArray(); BigInteger a = 1; for (int i = 1; i <= c.Length; i++) { a *= i; } BigInteger b = 1; var q1 = c.Distinct(); foreach (var i in q1) { int k = c.Where(x => x == i).Count(); for (int j = 1; j <= k; j++) { a /= j; } } Console.WriteLine(a % 573 -1); } //------------------------------------------------------------- static int[] ConvertStringArrayToIntArray(string[] array) { return Array.ConvertAll(array, str => int.Parse(str)); } static List ConvertStringArrayToIntList(string[] str) { var list = new List(); foreach (var c in str) { list.Add(int.Parse(c)); } return list; } } }