import java.util.*; import java.util.zip.*; import java.util.List; import java.util.regex.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.concurrent.locks.*; import java.util.function.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import javax.swing.table.*; import java.io.*; import java.net.*; import java.lang.reflect.*; import java.lang.ref.*; import java.lang.management.*; import java.security.*; import java.security.spec.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.awt.geom.*; import javax.imageio.*; import java.math.*; import java.time.Duration; // We store the angle in clockwise radians for more efficient // calculations. // So 0=right, pi=down etc. class main { static class Angle { Angle() {} double radians; Angle(double radians) { this.radians = radians;} // Create angle from x/y ratio Angle(double x, double y) { radians = atan2(x, y); } static Angle fromRadians(double radians) { return new Angle(radians); } static Angle fromDegrees(double degrees) { return new Angle(degreesToRadians(degrees)); } double radians() { return radians; } double degrees() { return radiansToDegrees(radians); } double x() { return cos(radians); } double y() { return sin(radians); } public String toString() { return formatDouble(degrees(), 1) + "°"; } } static double atan2(double x, double y) { return Math.atan2(x, y); } static double degreesToRadians(double deg) { return degreeToRadian(deg); } static double radiansToDegrees(double rad) { return radianToDegree(rad); } static double cos(double x) { return Math.cos(x); } static double sin(double x) { return Math.sin(x); } static String formatDouble(double d, int digits) { String format = digits <= 0 ? "0" : "0." + rep(digits, '#'); return decimalFormatEnglish(format, d); } static String formatDouble(double d) { return str(d); } static double degreeToRadian(double deg) { return deg*(pi()/180); } static double radianToDegree(double rad) { return rad*(180/pi()); } static String rep(int n, char c) { return repeat(c, n); } static String rep(char c, int n) { return repeat(c, n); } static List rep(A a, int n) { return repeat(a, n); } static List rep(int n, A a) { return repeat(n, a); } static String decimalFormatEnglish(String format, double d) { return decimalFormatEnglish(format).format(d); } static java.text.DecimalFormat decimalFormatEnglish(String format) { return new java.text.DecimalFormat(format, new java.text.DecimalFormatSymbols(Locale.ENGLISH)); } static String str(Object o) { return o == null ? "null" : o.toString(); } static String str(char[] c) { return new String(c); } static String str(char[] c, int offset, int count) { return new String(c, offset, count); } static double pi() { return Math.PI; } static String repeat(char c, int n) { n = Math.max(n, 0); char[] chars = new char[n]; for (int i = 0; i < n; i++) chars[i] = c; return new String(chars); } static List repeat(A a, int n) { n = Math.max(n, 0); List l = new ArrayList(n); for (int i = 0; i < n; i++) l.add(a); return l; } static List repeat(int n, A a) { return repeat(a, n); } }