Explicit expressions for the energy of dislocation configuration made up of piecewise straight segments