Comparison of three-dimensional Monte Carlo simulation and the pencil beam algorithm for an electron beam from a linear accelerator