We consider an inverse problem arising in thermo-/photo-acoustic tomography that amounts to reconstructing a function f from its circular or spherical means with the centers lying on a given measurement surface. (Equivalently, these means can be expressed through the solution u(t, x) of the wave equation with the initial pressure equal to f .) An explicit solution of this inverse problem is obtained in 3D for the surface that is the boundary of an open octet, and in 2D for the case when the centers of integration circles lie on two rays starting at the origin and intersecting at the angle equal to π/N , N = 2, 3, 4, .... Our formulas reconstruct the Radon projections of a function closely related to f , from the values of u(t, x) on the measurement surface. Then, function f can be found by inverting the Radon transform.