You will have a list of rationals in the form

```
lst = [ [numer_1, denom_1] , ... , [numer_n, denom_n] ]
```
or
```
lst = [ (numer_1, denom_1) , ... , (numer_n, denom_n) ]
```

where all numbers are positive integers. You have to produce their sum `N / D` in an irreducible form: this means that `N` and `D` have only `1` as a common divisor.

Return the result in the form:

- `[N, D]` in Ruby, Crystal, Python, Clojure, JS, CS, PHP, Julia
- `Just "N D"` in Haskell, PureScript
- `"[N, D]"` in Java, CSharp, TS, Scala, PowerShell, Kotlin
- `"N/D"` in Go, Nim
- `{N, D}` in C++, Elixir
- `{N, D}` in C
- `Some((N, D))` in Rust
- `Some "N D"` in F#, Ocaml
- `c(N, D)` in R
- `(N, D)` in Swift
- `'(N D)` in Racket

If the result is an integer (`D` evenly divides `N`) return:

- an integer in Ruby, Crystal, Elixir, Clojure, Python, JS, CS, PHP, R, Julia
- `Just "n"` (Haskell, PureScript)
- `"n"` Java, CSharp, TS, Scala, PowerShell, Go, Nim, Kotlin
- `{n, 1}` in C++
- `{n, 1}` in C
- `Some((n, 1))` in Rust
- `Some "n"` in F#, Ocaml,
- `(n, 1)` in Swift
- `n` in Racket 

If the input list is empty, return 

- `nil/None/null/Nothing` 
- `{0, 1}` in C++
- `{0, 1}` in C
- `"0"` in Scala, PowerShell, Go, Nim
- `O` in Racket
- `""` in Kotlin


### Example:

```
[ [1, 2], [1, 3], [1, 4] ]  -->  [13, 12]

    1/2  +  1/3  +  1/4     =      13/12
```

### Note
See sample tests for more examples and the form of results.

Difficulty: EASY
Tags: Fundamentals

Starter code:
def sum_fracts(lst):
	

Solutions:
from fractions import Fraction

def sum_fracts(lst):
	if lst:
		ret = sum((Fraction(a, b) for (a, b) in lst))
		return ret.numerator if ret.denominator == 1 else [ret.numerator, ret.denominator]


from fractions import Fraction

def sum_fracts(lst):
	s = sum((Fraction(*f) for f in lst))
	if s:
		return s.numerator if s.denominator == 1 else [s.numerator, s.denominator]


from fractions import Fraction

def sum_fracts(lst):
	if lst:
		ret = sum(map(lambda l: Fraction(*l), lst))
		return [ret.numerator, ret.denominator] if ret.denominator != 1 else ret.numerator


from fractions import Fraction

def sum_fracts(lst):
	if not lst:
		return None
	r = sum([Fraction(f[0], f[1]) for f in lst])
	return r.numerator if r.denominator == 1 else [r.numerator, r.denominator]


from fractions import Fraction

def sum_fracts(lst):
	out = Fraction(0, 1)
	for x in lst:
		out = out + Fraction(x[0], x[1])
	return None if out.numerator == 0 else out.numerator if out.denominator == 1 else [out.numerator, out.denominator]


from fractions import Fraction
from itertools import starmap

def sum_fracts(fractions):
	if not fractions:
		return None
	total = sum(starmap(Fraction, fractions))
	if total.denominator == 1:
		return total.numerator
	return [total.numerator, total.denominator]


def sum_fracts(lst):
	print(lst)
	if lst == []:
		return None
	ll = len(lst)
	(n, cd, md) = (2, 1, min((lst[i][1] for i in range(ll))))
	while n <= md:
		if all((lst[i][1] % n == 0 for i in range(ll))):
			cd = n
		n += 1
	print('max common divider: {}'.format(cd))
	dd = cd
	for i in range(ll):
		dd = dd * (lst[i][1] // cd)
	nn = sum((lst[i][0] * (dd // lst[i][1]) for i in range(ll)))
	(i, primes) = (0, [2, 3, 5, 7, 11, 13, 17])
	while i < len(primes):
		n = primes[i]
		if nn % n == 0 and dd % n == 0:
			nn = nn // n
			dd = dd // n
		else:
			i += 1
	if dd == 1:
		return nn
	else:
		return [nn, dd]


from fractions import Fraction

def sum_fracts(lst):
	f = sum((Fraction(n, d) for (n, d) in lst))
	return f.numerator or None if f.denominator == 1 else [f.numerator, f.denominator]


from fractions import Fraction
from itertools import starmap

def sum_fracts(lst):
	if lst:
		f = sum(starmap(Fraction, lst))
		return [f.numerator, f.denominator] if f.denominator > 1 else f.numerator