#include #include //#include using ll=long long; #define rep(i,a,b) for(int i=a;i; using PD=pair; using PL=pair; int mod1=998244353; int mod2=1000000007; const ll INF = 1000000000000000000; const int big = 2147483647; struct st{ ll x,y,z; st(ll x=0,ll y=0,ll z=0):x(x),y(y),z(z){} bool operator>(const st &a)const{ return x>a.x; } }; double dp[20010][20]; int main(){ double n,q,y=0,i,z=0,x=0,d=0,k,L,nk,sum=0,T; ll ans=INF,sum2=0,rs=-1e9,cs=0,l=0,h=0,r=0,X; ll tmp2=0,flag=0,a=0,b=0,c=0,j=0,m=0,p,S,K; ll N,M=0,R; double sc,tc,w=0.0; cin>>sc>>tc; cin>>N; vectorA; A.emplace_back(sc,tc); vectorcost; cost.push_back(0.0); rep(i,0,N){ cin>>x>>y>>z; A.emplace_back(x,y); cost.push_back(z); w+=z; } rep(i,0,1<<(N+1))rep(j,0,N+1)dp[i][j]=1e18; double iju=1e18; auto cal=[](double ty)->double{return (ty+100.0)/120.0;}; rep(i,1,N+1)dp[1<>j)&1)tmp-=cost[j]; rep(j,0,N+1){ rep(k,0,N+1){ if(!((i>>k)&1))continue; dp[i|(1<