Inspired by Goette-Semmelmann [10], we derive an estimate for the scalar curvature without a nonnegativity assumption on curvature operator. As an application, we show that, on an even dimensional closed manifold with nonzero Euler characteristic, any Riemannian metric g is \(\epsilon \) -gap distance extremal for some \(\epsilon \ge 0\) . For manifolds with boundary, inspired by Lott [21], we obtain a similar estimate for scalar curvature and mean curvature. We apply the estimate on certain Euclidean domains to study a Gromov’s question in [14] concerning the extension problem of metric on the boundary to the interior.