#!/usr/bin/perl -w

use v5.38;

my @stones = map { chomp; [ /-?\d+/g ] } <>;

my @eq;
for my $stone (0 .. 2) {
	my @st = @{ $stones[$stone] };
	for my $co (0 .. 2) {
		my $c = $st[$co+3];
		my $d = $st[$co];
		push @eq, "a$co * t$stone + b$co = $c*t$stone + $d";
	}
}
my @vars;
push @vars, "a$_", "b$_", "t$_" for 0 .. 2;

# Maple:
say "res := solve({\n\t", join(",\n\t", @eq), "\n},";
say "\t[", join(", ", @vars), " ]";
say ");";
say "res[1][2]+res[1][5]+res[1][8];";
