


	character f*80,fout*80
	aa=atan(1.)/45
	
	read(*,*)f
	read(*,*)fout
	open(10,file=f)
	open(20,file=fout)
	
	vadd=0
	aadd=0	
	do i = 1,99999999
	read(10,*,end=9)x,y,v
	vadd=vadd+v*cos(aa*y)
	aadd= aadd+cos(aa*y)
	end do

9	vm=	vadd/aadd
	write(*,*) 'mean v =', vm
	rewind(10)

	do i = 1,99999999
	read(10,*,end=91)x,y,v
	write(20,*)x,y,v-vm
	end do



91	stop
	end
		
