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;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles;
import java.text.*;
import java.util.TimeZone;
import static x30_pkg.x30_util.DynamicObject;
import java.text.NumberFormat;
import java.awt.geom.*;
class main {
static class PricePoint implements IFieldsToList{
static final String _fieldOrder = "timestamp price";
long timestamp;
double price;
PricePoint() {}
PricePoint(long timestamp, double price) {
this.price = price;
this.timestamp = timestamp;}
public boolean equals(Object o) {
if (!(o instanceof PricePoint)) return false;
PricePoint __1 = (PricePoint) o;
return timestamp == __1.timestamp && price == __1.price;
}
public int hashCode() {
int h = 516290023;
h = boostHashCombine(h, _hashCode(timestamp));
h = boostHashCombine(h, _hashCode(price));
return h;
}
public Object[] _fieldsToList() { return new Object[] {timestamp, price}; }
public String toString() {
return formatPrice(price) + " @ " + formatLocalDateWithSeconds(timestamp);
}
long time() { return timestamp; }
}
static int boostHashCombine(int a, int b) {
return a ^ (b + 0x9e3779b9 + (a << 6) + (a >>> 2));
// OLD (changed) 2022/3/10: ret a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2));
}
static int _hashCode(Object a) {
return a == null ? 0 : a.hashCode();
}
static String formatPrice(double price) {
//ret formatDouble2(price);
return formatDouble_significant(price, 6);
}
static String formatLocalDateWithSeconds(long time) {
return localDateWithSeconds(time);
}
static String formatLocalDateWithSeconds() {
return localDateWithSeconds();
}
static String formatDouble_significant(double d, int digits) {
return formatDouble_significant2(d, digits);
}
static String localDateWithSeconds(long time) {
SimpleDateFormat format = simpleDateFormat_local("yyyy/MM/dd HH:mm:ss");
return format.format(time);
}
static String localDateWithSeconds() {
return localDateWithSeconds(now());
}
static String formatDouble_significant2(double d, int digits) {
try {
digits -= Math.floor(max(-10, Math.log10(abs(d))+1));
return formatDouble(d, digits);
} catch (Throwable _e) {
print("Had number: " + d + ", digits: " + digits);
throw rethrow(_e); }
}
static SimpleDateFormat simpleDateFormat_local(String format) {
SimpleDateFormat sdf = new SimpleDateFormat(format);
sdf.setTimeZone(localTimeZone());
return sdf;
}
static long now_virtualTime;
static long now() {
return now_virtualTime != 0 ? now_virtualTime : System.currentTimeMillis();
}
static int max(int a, int b) { return Math.max(a, b); }
static int max(int a, int b, int c) { return max(max(a, b), c); }
static long max(int a, long b) { return Math.max((long) a, b); }
static long max(long a, long b) { return Math.max(a, b); }
static double max(int a, double b) { return Math.max((double) a, b); }
static float max(float a, float b) { return Math.max(a, b); }
static double max(double a, double b) { return Math.max(a, b); }
static > A max (Iterable l) {
A max = null;
var it = iterator(l);
if (it.hasNext()) {
max = it.next();
while (it.hasNext()) {
A a = it.next();
if (cmp(a, max) > 0)
max = a;
}
}
return max;
}
/*Nah.
static int max(Collection c) {
int x = Integer.MIN_VALUE;
for (int i : c) x = max(x, i);
ret x;
}*/
static double max(double[] c) {
if (c.length == 0) return Double.MIN_VALUE;
double x = c[0];
for (int i = 1; i < c.length; i++) x = Math.max(x, c[i]);
return x;
}
static float max(float[] c) {
if (c.length == 0) return Float.MAX_VALUE;
float x = c[0];
for (int i = 1; i < c.length; i++) x = Math.max(x, c[i]);
return x;
}
static byte max(byte[] c) {
byte x = -128;
for (byte d : c) if (d > x) x = d;
return x;
}
static short max(short[] c) {
short x = -0x8000;
for (short d : c) if (d > x) x = d;
return x;
}
static int max(int[] c) {
int x = Integer.MIN_VALUE;
for (int d : c) if (d > x) x = d;
return x;
}
static > A max(A a, A b) {
return cmp(a, b) >= 0 ? a : b;
}
static float abs(float f) { return Math.abs(f); }
static int abs(int i) { return Math.abs(i); }
static double abs(double d) { return Math.abs(d); }
static double abs(Complex c) { return c.abs(); }
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 volatile StringBuffer local_log = new StringBuffer(); // not redirected
static boolean printAlsoToSystemOut = true;
static volatile Appendable print_log = local_log; // might be redirected, e.g. to main bot
// in bytes - will cut to half that
static volatile int print_log_max = 1024*1024;
static volatile int local_log_max = 100*1024;
static boolean print_silent = false; // total mute if set
static Object print_byThread_lock = new Object();
static volatile ThreadLocal