A multidimensional generalization of Melvin's solution for an arbitrary simple Lie algebra G is presented. The gravitational model contains n 2-forms and l ≥ n scalar fields, where n is the rank of G. The solution is governed by a set of n functions obeying n ordinary differential equations with certain boundary conditions. It was conjectured earlier that these functions should be polynomials (the so-called fluxbrane polynomials). A program (in Maple) for calculating these polynomials for classical series of Lie algebras is suggested. The polynomials corresponding to the Lie algebra D 4 are obtained. It is conjectured that the polynomials for A n -, B n - and C n -series may be obtained from polynomials for D n+1-series by using certain reduction formulas. © 2009 Pleiades Publishing, Ltd.