/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package furniture; import java.util.Scanner; /** * * @author boban3 */ public class Furniture { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int pocetStolov = scanner.nextInt(); double vysledok = 0; for (int i = 0; i < pocetStolov; i++) { int Ax = scanner.nextInt(); int Ay = scanner.nextInt(); int Bx = scanner.nextInt(); int By = scanner.nextInt(); int Cx = scanner.nextInt(); int Cy = scanner.nextInt(); int Dx = scanner.nextInt(); int Dy = scanner.nextInt(); int[] u = new int[2]; u[0] = Ax - Bx; u[1] = Ay - By; int[] v = new int[2]; v[0] = Bx - Cx; v[1] = By - Cy; int[] w = new int[2]; w[0] = Cx - Dx; w[1] = Cy - Dy; double strana1 = Math.pow(u[0], 2) + Math.pow(u[1], 2); double strana2 = Math.pow(v[0], 2) + Math.pow(v[1], 2); double strana3 = Math.pow(w[0], 2) + Math.pow(w[1], 2); vysledok += Math.min(strana1, Math.min(strana2, strana3)); } System.out.println(vysledok); } } /* 4 1 0 1 -1 0 0 0 1 -2 -1 -2 1 -1 -2 -2 -3 -3 -2 -1 1 -1 -1 -3 -1 -3 1 0 -1 -2 3 0 3 */