A dynamic model of optimal capital accumulation for an enterprise