An inverse problem for the beam equation with memory with nonhomogeneous boundary conditions