implicit none integer(8) A,B,f,i,k,m,n integer(8),allocatable :: x(:) read(*,*) k,n,f allocate (x(f)) read(*,*) (x(m),m=1,f) A=0 do m=1,f A=A+x(m) end do B=k*n-A write(*,*) B end