A model for carbonate to terrigenous clastic sequences