Instrument for measuring vertical and horizontal angles, distances, and elevations