const calculateCount = amount => amount < 0 || amount % 10 ? -1 : [500, 200, 100, 50, 20, 10].reduce((c, v) => (c += Math.floor(amount / v), amount %= v, c), 0)