  Spacetime foam is analyzed within the simplistic model of a set of scalar
fields on a flat background. We suggest the formula for the path integral which
allows to account for the all possible topologies of spacetime. We show that
the proper path integral defines a cutoff for the field theory. The form of the
cutoff is fixed by the field theory itself and has no free additional
parameters. New features of the Feynman diagram technic are outlined and
possible applications in quantum gravity are discussed.
