In 20 days 'A' do 1 piece of work.

So in 1 days 'A' do 1/20 piece of work.

so, in 5 days 'A' do 5/20 = 1/4 piece of work.

In 30 days 'B' can do 1 piece of work.

So in 1 day 'B' can do 1/30 piece of work.

So in 5 days 'B' can do 5/30 = 1/6 piece of work.

therefore in 1 day A+B can do 1/20+1/30 = 1/12 piece of work.

Given that B left the work 5 days before its complete .

then left work complete by 'A' in last 5 days.

so we can say that left work = woke done in 5 days by A = 1/4 piece

so ,Finally we can say that (1-1/4 = 3/4) piece of work done together by A+B

we know that,

A+B can do 1/12 piece of work in 1 day

So,A+B can do 1 piece of work in 1÷1/12 = 12 days

So ,A+B can do 3/4 piece of works in 12×3/4 = 9 days

so 3/4 work was completed by A and B in 9 days.

and left work(1/4 piece) was completed by A in 5 days.

Therefore whole work was completed in 9+5 = 14 days