Optimal exchange rate regimes: sunspots, currency crises, and welfare