size = 4
lst = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 23, 2, 3, 99]
res = lst[:size] + lst[-size:]
print(res)

127327a054b0e3ee2b7029cfaea13082dfda96d5
<mask token>

<mask token>
print(res)

size = 4
lst = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 23, 2, 3, 99]
res = lst[:size] + lst[-size:]
print(res)
