Optimal Production Planning in a Stochastic N-machine Flowshop with Long-Run Average Cost