def sumlist(x, y):
    """
    Sums two lists of the same shape elementwise. Returns the sum.
    """
    z = x
    for i in range(0, len(z)):
        if isinstance(x[i], list) and isinstance(y[i], list):
            z[i] = sumlist(x[i], y[i])
        else:
            z[i] = x[i] + y[i]
    return z