A budget of $1500 was established for the 340 and $3k for the 318. With those miniscule budgets (I didn't make the rules), you'd have to assume both engines are 'usable' with minimal to no machine work necessary (ie. backyard rebuild, hone, re-ring, bearing, lap valves, and reassemble).
If the 340 needed new heads, it's probably out of the discussion all together. If the 318 needed heads, that $3k starts decreasing very quickly and pretty much eliminates the possibility of the 50 extra cubes.