def distribute(files, num_procs):
    """
    Distribute files accross num_procs, assumes files is sorted.

    >>> distribute([1, 2, 3, 4, 5, 6, 7, 8, 9], 4)
    [1, 5, 9, 2, 6, 3, 7, 4, 8]
    >>> distribute([1, 2, 3, 4, 5, 6, 7, 8], 4)
    [1, 5, 2, 6, 3, 7, 4, 8]
    >>> distribute([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 4)
    [1, 5, 9, 2, 6, 10, 3, 7, 4, 8]
    """
    shuf = list()
    for proc in range(num_procs):
        proc_idx = 0
        while proc_idx + proc < len(files):
            shuf.append(files[proc_idx + proc])
            proc_idx += num_procs
    return shuf
