from dataclasses import dataclass

# (a) Vehicle


@dataclass
class Vehicle:
    seats: int
    hp: int
    ccm: int
    weight: int

    def __post_init__(self):
        assert 0 < self.seats < 10
        assert 0 < self.hp
        assert 0 < self.ccm
        assert 0 < self.weight

    def fun_factor(self) -> float:
        return (10 * self.hp + self.ccm) / self.weight

    def __gt__(self, other: 'Vehicle') -> bool:
        return self.fun_factor() > other.fun_factor()

# (b) Car


@dataclass
class Car(Vehicle):
    spoiler: bool

    def fun_factor(self) -> float:
        return super().fun_factor() + (0.2 if self.spoiler else 0)


# (c) Motorcycle


@dataclass
class Motorcycle(Vehicle):
    sidecar: bool

    def __post_init__(self):
        super().__post_init__()
        if self.sidecar:
            assert 2 <= self.seats <= 3
        else:
            assert 1 <= self.seats <= 2

    def fun_factor(self) -> float:
        return super().fun_factor() * (2.4 if self.sidecar else 3)