The crustal structure from teleseismic P-wave coda—I. Method