Modeling the interaction of resource flows in the foreign trade system