library Percent {
  // Solidity automatically throws when dividing by 0
  struct percent {
    uint num;
    uint den;
  }
  
  // storage
  function mul(percent storage p, uint a) internal view returns (uint) {
    if (a == 0) {
      return 0;
    }
    return a*p.num/p.den;
  }

  function div(percent storage p, uint a) internal view returns (uint) {
    return a/p.num*p.den;
  }

  function sub(percent storage p, uint a) internal view returns (uint) {
    uint b = mul(p, a);
    if (b >= a) {
      return 0;
    }
    return a - b;
  }

  function add(percent storage p, uint a) internal view returns (uint) {
    return a + mul(p, a);
  }

  function toMemory(percent storage p) internal view returns (Percent.percent memory) {
    return Percent.percent(p.num, p.den);
  }

  // memory 
  function mmul(percent memory p, uint a) internal pure returns (uint) {
    if (a == 0) {
      return 0;
    }
    return a*p.num/p.den;
  }

  function mdiv(percent memory p, uint a) internal pure returns (uint) {
    return a/p.num*p.den;
  }

  function msub(percent memory p, uint a) internal pure returns (uint) {
    uint b = mmul(p, a);
    if (b >= a) {
      return 0;
    }
    return a - b;
  }

  function madd(percent memory p, uint a) internal pure returns (uint) {
    return a + mmul(p, a);
  }
}
/**
 * ETH CRYPTOCURRENCY DISTRIBUTION PROJECT
 * 
 * Web              - https://333eth.io
 * 
 * Twitter          - https://twitter.com/333eth_io
 * 
 * Telegram_channel - https://t.me/Ethereum333
 * 
 * EN  Telegram_chat: https://t.me/Ethereum333_chat_en
 * 
 * RU  Telegram_chat: https://t.me/Ethereum333_chat_ru
 * 
 * KOR Telegram_chat: https://t.me/Ethereum333_chat_kor
 * 
 * Email:             mailto:support(at sign)333eth.io
 * 
 * 
 * 
 * When the timer reaches zero then latest bettor takes the bank. Each bet restart a timer again.
 * 
 * Bet 0.01 ETH - if balance < 100 ETH
 * Bet 0.02 ETH - if 100 ETH <= balance <= 200 ETH
 * Bet 0.03 ETH - if 200 ETH < balance
 * 
 * The timer turns on for 5 minutes always. 
 *    
 * You need to send such bet`s amounts. If more was sent, then contract will return the difference to the wallet. For example, sending 0.03 ETH system will perceive as a contribution to 0.01 ETH and difference 0.02
 * 
 * The game does not have a fraudulent Ponzi scheme. No fraudulent referral programs.
 * 
 * In the contract of the game realized the refusal of ownership. It is impossible to stop the flow of bets. Bet from smart contracts is prohibited.
 * 
 * Eth distribution:
 * 50% paid to the winner.
 * 33% is transferred to the next level of the game with the same rules and so on.
 * 17% commission.
 * 
 * RECOMMENDED GAS LIMIT: 150000
 * 
 * RECOMMENDED GAS PRICE: https://ethgasstation.info/
 */
function mul(percent storage p, uint a) internal view returns (uint) {
    if (a == 0) {
      return 0;
    }
    return a*p.num/p.den;
  }
// storage