def take_n(n, s):
    """Take n characters from string s"""
    m = len(s)  # the actual number of characters in s
    if m == n:
        return s
    a, b = divmod(n, m)  # repeat s 'a' times and add 'b' chars to get size n
    return s * a + s[:b]