Pontryagin maximum principle and Stokes theorem