// File: /splitter/contracts/Splitter.sol



// SPDX-License-Identifier: Unlicensed

// Deployed with the Atlas IDE
// https://app.atlaszk.com

pragma solidity ^0.8.19;

contract Splitter {
    address payable public recipient1 = payable(0x4C14EbC1ee74964593632eCaD6AA967f9A023a9F);
    address payable public recipient2 = payable(0x1A02f9c21816C772a7066fdF565E97532EaC9395);
    address payable public recipient3 = payable(0x81c1a5CF8B7e995D42E146C842bfE17e4B5DbE3D);
    address payable public recipient4 = payable(0xBC161e3009e60AA6e0B5D4941dd327ee1088D645);

    receive() external payable {
        uint256 amount1 = msg.value * 333 / 1000; // 33.3%
        uint256 amount2 = msg.value * 222 / 1000; // 22.2%
        uint256 amount3 = msg.value * 222 / 1000; // 22.2%
        uint256 amount4 = msg.value * 222 / 1000; // 22.2%

        recipient1.transfer(amount1);
        recipient2.transfer(amount2);
        recipient3.transfer(amount3);
        recipient4.transfer(amount4);
        // The remaining amount after integer division might be slightly less than the exact split. 
        // To avoid locking up any funds in the contract, we send the remaining balance to recipient1.
        recipient1.transfer(address(this).balance);
    }

    // This function is to recover any funds accidentally sent to the contract directly
    function recover() public {
        payable(msg.sender).transfer(address(this).balance);
    }
}