# Explanation

It's your first day in the robot factory and your supervisor thinks that you should start with an easy task. So you are responsible for purchasing raw materials needed to produce the robots.

A complete robot weights `50` kilogram. Iron is the only material needed to create a robot. All iron is inserted in the first machine; the output of this machine is the input for the next one, and so on. The whole process is sequential. Unfortunately not all machines are first class, so a given percentage of their inputs are destroyed during processing.

# Task

You need to figure out how many kilograms of iron you need to buy to build the requested number of robots.

# Example

Three machines are used to create a robot. Each of them produces `10%` scrap. Your target is to deliver `90` robots.  
The method will be called with the following parameters:

```
CalculateScrap(scrapOfTheUsedMachines, numberOfRobotsToProduce)
CalculateScrap(int[] { 10, 10, 10 }, 90)
```

# Assumptions

* The scrap is less than `100%`.
* The scrap is never negative.
* There is at least one machine in the manufacturing line.
* Except for scrap there is no material lost during manufacturing.
* The number of produced robots is always a positive number.
* You can only buy full kilograms of iron.

Source: codewars | Difficulty: EASY

Starter code: def calculate_scrap(scraps, number_of_robots):
	

Solutions:
from math import ceil

def calculate_scrap(arr, n):
	x = 50
	for i in arr:
		x /= 1 - i / 100
	return ceil(n * x)


from functools import reduce
from operator import mul
from math import ceil

def calculate_scrap(scraps, number_of_robots):
	return ceil(50 * number_of_robots * 100 ** len(scraps) / reduce(mul, (100 - x for x in scraps)))


from fractions import Fraction
from functools import reduce
from math import ceil
from operator import mul

def calculate_scrap(scraps, n):
	return ceil(n * 50 * reduce(mul, (Fraction(100, 100 - scrap) for scrap in scraps)))


def calculate_scrap(scraps, number_of_robots):
	iron = 50 * number_of_robots
	for x in range(len(scraps)):
		iron = iron / (1 - scraps[x] / 100)
	return round(iron + 0.5)


from fractions import Fraction as F
from math import ceil

def calculate_scrap(scraps, number_of_robots):
	cost = 50
	for pct in scraps:
		factor = F(100, 100 - pct)
		cost *= factor
	return ceil(cost * number_of_robots)


from math import ceil

def calculate_scrap(scraps, number_of_robots):
	if len(scraps) == 1:
		return ceil(50 * number_of_robots / ((100 - scraps[0]) / 100))
	else:
		divisor = 1
		for i in scraps:
			divisor *= (100 - i) / 100
		return ceil(50 * number_of_robots / divisor)


import math

def calculate_scrap(scraps, num):
	mat = num * 50
	for x in scraps:
		mat = mat / (0.01 * (100 - x))
	return math.ceil(mat)


from math import ceil

def calculate_scrap(scraps, number_of_robots):
	factor = 1
	for x in scraps:
		factor *= 1 - x / 100
	return ceil(50 / factor * number_of_robots)


from functools import reduce

def calculate_scrap(scraps, number_of_robots):
	ans = reduce(lambda x, y: x / (100 - y) * 100, scraps, number_of_robots * 50)
	return int(ans) if ans.is_integer() else int(ans) + 1