private static long count(int[] a, int limiter, int target) { if(limiter == 1) return target % a[0] == 0 ? 1 : 0; long c = 0; int i; for(i = target; i >= 0; i-=a[limiter - 1]) { c = c + count(a, limiter - 1, i); } return c; }