Dynamic response to foreign transfers and terms-of-trade shocks in open economies