Rebuilding parts of Malawi that were devastated by floods in January will take up to five years and may cost more than $400 million, the United Nations said on Thursday.