public function calcChecksum($input)
    {
        $wi = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
        $sum = 0;

        for ($i = 16; $i >= 0; $i--) {
            $sum += $input[$i] * $wi[$i];
        }

        $checksum = (12 - $sum % 11) % 11;

        return $checksum == 10 ? 'X' : (string)$checksum;
    }