class Line
	require 'matrix'
	#ax+by = c   (a > 0 or (a == 0 && b > 0))
	def self.through_two_points(x1, y1, x2, y2)
		a = y1 - y2
		b = x2 - x1
		c = a * x1 + b * y1
		new(a, b, c, x1, y1, x2, y2)
	end

	def cross_point(l)
		m = Matrix[
			[@a, @b],
			[l.a, l.b],
		];
		v = Vector[@c, l.c]
		return (m.inv * v).to_a
	end

	private_class_method :new

	def initialize(*args)
		@a, @b, @c, @x1, @y1, @x2, @y2 = args	
	end

	def *(x)
		if x.class == Array
			line_point(x)
		elsif x.class == Line
			cross_point(x)
		end
	end

	def line_point(point)
		x3, y3 = point
		v0 = Vector[@x1, @y1]
		v1 = Vector[@x2 - @x1, @y2 - @y1]
		v2 = Vector[x3 - @x1, y3 - @y1]
		v3 = 2 * v1 * v1.inner_product(v2) / v1.r ** 2 - v2 + v0
		v3.to_a
	end

	attr_reader :a, :b, :c, :x1, :y1, :x2, :y2
end

class Array
	def *(x)
		if x.class == Array
			point_point(x)
		elsif x.class == Line
			x * self
		end
	end

	def point_point(a)
		x1, y1 = self
		x2, y2 = a
		Line.through_two_points(x1, y1, x2, y2)
	end
end

loop do
	exp = gets.chomp
	break if exp == ?#
	exp.gsub!(/\((-?\d+,-?\d+)\)/, '[\1]')
	exp.gsub!(?@, ?*)
	puts eval(exp).map(&:to_f).join " "
end