<?php

class Point
{
  public int $X;
  public int $Y;

  function __construct(int $X, int $Y)
  {
    $this->X = $X;
    $this->Y = $Y;
  }
}

function NewPoint(int $X, int $Y): Point
{
  $Point = new Point($X, $Y);
  return $Point;
}

/* Linear interpolation between two points */
function Interpolation(Point $P1, Point $P2, $X): float
{
  $Y = ($P2->Y - $P1->Y) / ($P2->X - $P1->X) * ($X - $P1->X) + $P1->Y;
  return $Y;
}
