Language: C++

#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	Info(){
		to = dist = cost = 0;
	}

	bool operator<(const struct Info &arg) const{
		return dist < arg.dist;
	};
	Info(int arg_to,int arg_dist,int arg_cost){
		to = arg_to;
		dist = arg_dist;
		cost = arg_cost;
	}

	int to,dist,cost;
};

int N,M,min_dist[10001],min_cost[10001];

vector<Info> V[10001];

void func(){

	for(int i = 1; i <= N; i++){
		V[i].clear();
		min_dist[i] = BIG_NUM;
		min_cost[i] = BIG_NUM;
	}

	int from,to,dist,cost;

	for(int i = 0; i < M; i++){
		scanf("%d %d %d %d",&from,&to,&dist,&cost);
		V[from].push_back(Info(to,dist,cost,i));
		V[to].push_back(Info(from,dist,cost,i));
	}

	priority_queue<Info> Q;

	min_dist[1] = 0;
	min_cost[1] = 0;

	for(int i = 0; i < V[1].size(); i++){
		min_dist[V[1][i].to] = V[1][i].dist;
		min_cost[V[1][i].to] = V[1][i].cost;
		Q.push(Info(V[1][i].to,V[1][i].dist,V[1][i].cost,0));
	}

	int min_index;

	while(!Q.empty()){
		if(Q.top().dist > min_dist[Q.top().to] || Q.top().cost > min_cost[Q.top().to]){
			Q.pop();
		}else{
			min_index = Q.top().to;
			Q.pop();

			for(int i = 0; i < V[min_index].size(); i++){
				if(min_dist[V[min_index][i].to] > min_dist[min_index]+V[min_index][i].dist){
					min_dist[V[min_index][i].to] = min_dist[min_index]+V[min_index][i].dist;
					min_cost[V[min_index][i].to] = V[min_index][i].cost;
					Q.push(Info(V[min_index][i].to,min_dist[V[min_index][i].to],min_cost[V[min_index][i].to],0));
				}else if(min_dist[V[min_index][i].to] == min_dist[min_index]+V[min_index][i].dist && min_cost[V[min_index][i].to] > V[min_index][i].cost){
					min_cost[V[min_index][i].to] = V[min_index][i].cost;
					Q.push(Info(V[min_index][i].to,min_dist[V[min_index][i].to],min_cost[V[min_index][i].to],0));
				}
			}
		}
	}

	int ans = 0;

	for(int i = 2; i <= N; i++)ans += min_cost[i];

	printf("%d\n",ans);

}

int main(){

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		func();
	}

	return 0;
}

Compiler output:
a.cc: In function 'void func()':
a.cc:50:54: error: no matching function for call to 'Info::Info(int&, int&, int&, int&)'
   50 |                 V[from].push_back(Info(to,dist,cost,i));
      |                                                      ^
a.cc:25:9: note: candidate: 'Info::Info(int, int, int)'
   25 |         Info(int arg_to,int arg_dist,int arg_cost){
      |         ^~~~
a.cc:25:9: note:   candidate expects 3 arguments, 4 provided
a.cc:18:9: note: candidate: 'Info::Info()'
   18 |         Info(){
      |         ^~~~
a.cc:18:9: note:   candidate expects 0 arguments, 4 provided
a.cc:17:8: note: candidate: 'constexpr Info::Info(const Info&)'
   17 | struct Info{
      |        ^~~~
a.cc:17:8: note:   candidate expects 1 argument, 4 provided
a.cc:17:8: note: candidate: 'constexpr Info::Info(Info&&)'
a.cc:17:8: note:   candidate expects 1 argument, 4 provided
a.cc:51:54: error: no matching function for call to 'Info::Info(int&, int&, int&, int&)'
   51 |                 V[to].push_back(Info(from,dist,cost,i));
      |                                                      ^
a.cc:25:9: note: candidate: 'Info::Info(int, int, int)'
   25 |         Info(int arg_to,int arg_dist,int arg_cost){
      |         ^~~~
a.cc:25:9: note:   candidate expects 3 arguments, 4 provided
a.cc:18:9: note: candidate: 'Info::Info()'
   18 |         Info(){
      |         ^~~~
a.cc:18:9: note:   candidate expects 0 arguments, 4 provided
a.cc:17:8: note: candidate: 'constexpr Info::Info(const Info&)'
   17 | struct Info{
      |        ^~~~
a.cc:17:8: note:   candidate expects 1 argument, 4 provided
a.cc:17:8: note: candidate: 'constexpr Info::Info(Info&&)'
a.cc:17:8: note:   candidate expects 1 argument, 4 provided
a.cc:62:67: error: no matching function for call to 'Info::Info(int&, int&, int&, int)'
   62 |                 Q.push(Info(V[1][i].to,V[1][i].dist,V[1][i].cost,0));
      |                                                                   ^
a.cc:25:9: note: candidate: 'Info::Info(int, int, int)'
   25 |         Info(int arg_to,int arg_dist,int arg_cost){
      |         ^~~~
a.cc:25:9: note:   candidate expects 3 arguments, 4 provided
a.cc:18:9: note: candidate: 'Info::Info()'
   18 |         Info(){
      |         ^~~~
a.cc:18:9: note:   candidate expects 0 arguments, 4 provided
a.cc:17:8: note: candidate: 'constexpr Info::Info(const Info&)'
   17 | struct Info{
      |        ^~~~
a.cc:17:8: note:   candidate expects 1 argument, 4 provided
a.cc:17:8: note: candidate: 'constexpr Info::Info(Info&&)'
a.cc:17:8: note:   candidate expects 1 argument, 4 provided
a.cc:78:131: error: no matching function for call to 'Info::Info(int&, int&, int&, int)'
   78 |                                         Q.push(Info(V[min_index][i].to,min_dist[V[min_index][i].to],min_cost[V[min_index][i].to],0));
      |                                                                                                                                   ^
a.cc:25:9: note: candidate: 'Info::Info(int, int, int)'
   25 |         Info(int arg_to,int arg_dist,int arg_cost){
      |         ^~~~
a.cc:25:9: note:   candidate expects 3 arguments, 4 provided
a.cc:18:9: note: candidate: 'Info::Info()'
   18 |         Info(){
      |         ^~~~
a.cc:18:9: note:   candidate expects 0 arguments, 4 provided
a.cc:17:8: note: candidate: 'constexpr Info::Info(const Info&)'
   17 | struct Info{
      |        ^~~~
a.cc:17:8: note:   candidate expects 1 argument, 4 provided
a.cc:17:8: note: candidate: 'constexpr Info::Info(Info&&)'
a.cc:17:8: note:   candidate expects 1 argument, 4 provided
a.cc:81:131: error: no matching function for call to 'Info::Info(int&, int&, int&, int)'
   81 |                                         Q.push(Info(V[min_index][i].to,min_dist[V[min_index][i].to],min_cost[V[min_index][i].to],0));
      |                                                                                                                                   ^
a.cc:25:9: note: candidate: 'Info::Info(int, int, int)'
   25 |         Info(int arg_to,int arg_dist,int arg_cost){
      |         ^~~~
a.cc:25:9: note:   candidate expects 3 arguments, 4 provided
a.cc:18:9: note: candidate: 'Info::Info()'
   18 |         Info(){
      |         ^~~~
a.cc:18:9: note:   candidate expects 0 arguments, 4 provided
a.cc:17:8: note: candidate: 'constexpr Info::Info(const Info&)'
   17 | struct Info{
      |        ^~~~
a.cc:17:8: note:   candidate expects 1 argument, 4 provided
a.cc:17:8: note: candidate: 'constexpr Info::Info(Info&&)'
a.cc:17:8: note:   candidate expects 1 argument, 4 provided