public static void main(String[] args){
		int[] fac = new int[10];
		for (int i=0;i<10;i++) fac[i] = factorial(i);
		int sum=0;
		for(int i=10;i<2e7;i++){
			if (i == facSum(i, fac)) sum+=i;
		}
		System.out.println(sum);
	}