Amplitude analysis of D0→K−π+π+π−