program magic_square_2
  implicit none
  integer :: a, b, c, m(3,3)
  read(*,*) a
  read(*,*) b
  read(*,*) c
  m = 0
  m(1,1) = a
  m(1,2) = b
  m(1,3) = 3*c-a-b
  m(2,1) = 4*c-2*a-b
  m(2,2) = c
  m(2,3) = 2*a+b-2*c
  m(3,1) = a+b-c
  m(3,2) = 2*c-b
  m(3,3) = 2*c-a
  write(*,'(i0,x,i0,x,i0)') m(1,:)
  write(*,'(i0,x,i0,x,i0)') m(2,:)
  write(*,'(i0,x,i0,x,i0)') m(3,:)
  stop
end program magic_square_2