Help me in solving SEQSEARCH problem

My issue

why is this not working…
can anyone explain the question in detail and an efficient approach please?

My code

for _ in range(int(input())):
    a,b,k=map(int,input().split())
    l=list((0,a,b))
    for i in range(3,k+min((k,a,b))):
        l.append((l[i-1]+l[i-2]-l[i-3]))
    print(sorted(l)[k-1])

Problem Link: Sequence Search Practice Coding Problem