In a population of 40,000 individuals, panels show malaria prevalence (PfPR2-10, left), allele frequency of 580Y (middle), and the genotype frequency of piperaquine-resistant parasites (right) over a period of 20 years after a mass drug administration has been carried out. In these scenarios, baseline PfPR2-10 = 2%. Median trajectories are shown from 1000 simulations, and the shaded areas (left panels) show the interquartile range. Simulations are colored by the number of rounds of MDA carried out: blue (0), orange (1), green (2), red (3), purple (4). The top row (panels A, B, C) shows a scenario with no importation of drug-resistant genotypes and no improvement in treatment coverage (ITC) after the MDA is carried out. The second row (D, E, F) shows a scenario where new parasite importation occurs every 10 days; the imported parasite has a 50% probability of carrying the 580Y allele and a 50% probability of carrying piperaquine resistance, independently. The third row (G, H, I) shows a scenario with no importation, but where treatment coverage is increased post-MDA to 80% of the symptomatic patient population. The fourth row (J, K, L) shows a scenario with both importation and ITC. In the middle and right columns, the light gray lines show the absolute number of infected individuals (of any parasitaemia level) in the simulation and correspond to the right-hand gray tick marks on each panel. Note for example that in panels K and L, artemisinin-resistant and piperaquine-resistant genotype frequencies are very high, but in a population of only about 100 infected individuals, most of which are imports that occur during the course of the simulation; this region appears to have eliminated malaria but recently imported parasite-positive cases can still be found. MDA begins at year zero, and the first-year drop in prevalence can be seen in all plots in the left column. The bottleneck period lasts months to years, depending on the number of rounds of MDA carried out. Rapid selection of 580Y can be seen during the bottleneck period when importation is present (panels E and K). Piperaquine-resistant genotypes are maintained in the population through linkage disequilibrium with 580Y genotypes (panels F and L, see Fig F in S1 Text). The bottleneck period is risky when importation of 580Y alleles is expected; under these conditions, more rounds of MDA result in worse long-term drug-resistance outcomes (panel E).