contract Coallition is Owned {
     using SafeMath for uint;
     
     mapping(uint256 => address) members;
     mapping(address => uint256) shares;
     
     uint256 total;
     constructor () public {
         
    }
     function addmember(uint256 index , address newmember) public onlyOwner  {
   members[index] = newmember;
}
     function addshares(uint256 sharestoadd , address member) public onlyOwner  {
shares[member] += sharestoadd;
}
function deductshares(uint256 sharestoadd , address member) public onlyOwner  {
   shares[member] -= sharestoadd;
}
function setshares(uint256 sharestoadd , address member) public onlyOwner  {
   shares[member] = sharestoadd;
}
// set total number of members
function settotal(uint256 set) public onlyOwner  {
   total = set;
}
    function payout() public payable {
        
   for(uint i=0; i< total; i++)
        {
            uint256 totalshares;
            totalshares += shares[members[i]];
        }
        uint256 base = msg.value.div(totalshares);
    for(i=0; i< total; i++)
        {
            
            uint256 amounttotransfer = base.mul(shares[members[i]]);
            members[i].transfer(amounttotransfer);
            
        }
}
 function () external payable{payout();}     
}
function settotal(uint256 set) public onlyOwner  {
   total = set;
}

// set total number of members