import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.RoundingMode;

class MyVector {
	private double x;
	private double y;
	public MyVector(double x, double y) {
		this.x = x; 
		this.y = y;
	}
	public double vLength() {
		double tempLen =  Math.sqrt(x*x + y*y);
		double newLen = new BigDecimal(tempLen).setScale(3, RoundingMode.UP).doubleValue();
		return newLen;
	}
	public static MyVector sum(MyVector a, MyVector b) {
		return new MyVector(a.x + b.x, a.y + b.y);
	}
	public static MyVector sub(MyVector a, MyVector b) {
		return new MyVector(a.x - b.x, a.y - b.y);
	}
	public static MyVector mul(MyVector a, double c) {
		return new MyVector(a.x * c, a.y * c);
	}
	public static double scalar(MyVector a, MyVector b) {
		double tempScalar = a.x * b.x + a.y * b.y;
		double newScalar = new BigDecimal(tempScalar).setScale(3, RoundingMode.UP).doubleValue();
		return newScalar;
	}
	public static double cos(MyVector a, MyVector b) {
		double tempCos = scalar(a, b) / (a.vLength() * b.vLength());
		double newCos = new BigDecimal(tempCos).setScale(3, RoundingMode.UP).doubleValue();
		return newCos;
	}
	public static double projection(MyVector a, MyVector b) {
		double tempProj = scalar(a, b) / b.vLength();
		double newProj = new BigDecimal(tempProj).setScale(5, RoundingMode.UP).doubleValue();
		return newProj;
	}
	public static boolean isCollinear(MyVector a, MyVector b) throws ArithmeticException {
		double eps = 0.0001;
		if (b.x == 0 || b.y == 0) {
			throw new ArithmeticException("Zero divider");
		}
		return (Math.abs(a.x / b.x - a.y / b.y) < eps);
	}
	public static double vecProduct(MyVector a, MyVector b) {
		double tempProduct = a.vLength() * b.vLength() * Math.sqrt(1 - cos(a,b) * cos(a,b));
		double newProduct = new BigDecimal(tempProduct).setScale(5, RoundingMode.UP).doubleValue();
		return newProduct;
	}
	public String toString() {
		return new String(x + " ; " + y );
	}
}

class Main {
	public static void main (String[] args) {
		MyVector a = new MyVector(10.1,-19);
		MyVector b = new MyVector(13,-2.09);
		System.out.println(a.vLength());
		System.out.println(b.vLength());
		System.out.println(MyVector.sum(a,b));
		System.out.println(MyVector.sub(a,b));
		System.out.println(MyVector.mul(a,8));
		System.out.println(MyVector.scalar(a,b));
		System.out.println(MyVector.cos(a,b));
		System.out.println(MyVector.projection(a,b));
		System.out.println(MyVector.isCollinear(a,b));
		System.out.println(MyVector.vecProduct(a,b));
	}
}