def unsigned_to_signed(seq, width):
    """
    Convert unsigned integer to signed.
    """
    out = []
    k = pow(2, width)
    for x in seq:
        if x >= k/2:
            x -= k
        out.append(x)
    return out