#include<cstdio>
#include<cmath>
#include<vector>
using namespace std;
const int maxn = 100010;
bool isroot[maxn] = { false };
struct Node
{
int data;
vector<int> v;
}node[maxn];
int n;
double P, R;
double ans = 0;
void dfs(int root,int depth)
{
if (node[root].v.size() == 0)
{
ans += node[root].data*P*pow(1 + R / 100, depth);
return;
}
for (int i = 0; i < node[root].v.size(); i++)
{
dfs(node[root].v[i], depth + 1);
}
}
int main()
{
int temp,child;
scanf("%d %lf %lf", &n, &P, &R);
for (int i = 0; i < n; i++)
{
scanf("%d", &temp);
if (temp != 0)
{
for (int j = 0; j < temp; j++)
{
scanf("%d", &child);
node[i].v.push_back(child);
isroot[child] = true;
}
}
else
{
scanf("%d", &node[i].data);
}
}
int root,i;
for (i = 0; i < n; i++)
{
if (isroot[i] == false) break;
}
root = i;
dfs(root, 0);
printf("%.1f", ans);
return 0;
}
做完才发现已经给出了根结点为0,可以去掉判断根结点的部分