module adder_4to3(in, cout, carry, sum);

input [3:0] in;
wire x0, x1, x2, x3;
output cout, carry, sum;

assign {x0, x1, x2, x3} = in;

wire s0, c0, c1;

FA FA0(x0, x1, x2, s0, c0);
HA HA0(x3, s0, sum, c1);
HA HA1(c0, c1, carry, cout);

endmodule