def calculation_with_circular_num(a,b)
	a_str, b_str = [a,b].map(&:to_s)
end
readlines.each do |l|
	a,b = l.split.map(&:to_f)
	num = (a/b).to_s
	dot_index = num.index(".")

	num_holder = Hash.new
	num_holder.default = []
	is_circular = false
	tail_id = 0

	num[dot_index+1..-1].chars.with_index do |x, i|
		if num_holder[x].include?(num[i+1])
			is_circular = true
			tail_id = i 
			break
		end
		break if i == num.size-1
		num_holder[x] << num[i+1]
	end

	if is_circular
		puts num[dot_index+1..tail_id]
		puts " "*(tail_id-2) + "^"
	else
		puts num[dot_index+1..-1]
	end
end