Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func main() {
	scanner.Split(bufio.ScanWords)
	startTemp, _ := nextInt()
	targetTemp, _ := nextInt()
	deltaFrozen, _ := nextInt()
	deltaZero, _ := nextInt()
	deltaNotFrozen, _ := nextInt()

	requiredTime := 0

	if startTemp < 0 {
		requiredTime += -startTemp * deltaFrozen
	}
	if startTemp <= 0 {
		requiredTime += deltaZero
	}
	if startTemp <= 0 {
		requiredTime += targetTemp * deltaNotFrozen
	} else {
		requiredTime += (targetTemp - startTemp) * deltaNotFrozen
	}

	fmt.Println(requiredTime)
}

C++: #include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a<0 && b<0){
        cout<<(b-a)*c<<endl;
    }else if(a<0 && b>0){
        cout<<-a*c+d+b*e<<endl;
    }else if(a>0 && b>0){
        cout<<(b-a)*e<<endl;
    }
    
}


/*
abcdea

/root
a.txt
bunp.html
/desktop
r.txt
fsharp.cs
dp.cpp
/users
bison.txt

root r.txt
users r.txt
users a.txt

desktop/r.txt
../r.txt
../../a.txt
*/

C++: //============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
typedef struct pair<int,int> P;
int A,B,C,D,E;
int main() {
	cin>>A>>B>>C>>D>>E;

	int R=0;
	if(A>0)R=(B-A)*E;
	if(A<0)R=(0-A)*C+D+B*E;

	cout<<R<<endl;
	return 0;
}

C++: #include<cstdio>
using namespace std;
int main(void)
{
  int a,b,c,d,e,x;
  scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
  if(a<0 && b<=0)	{
    x=(b-a)*c;
  }
  else if(a<0 && b>0)	{
    x=(0-a)*c+d+b*e;
  }
  else {
    x=(b-a)*e;
  }
  printf("%d\n",x);
  return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int main() {
	// your code goes here
	int a,b,c,d,e;
	cin >>a >>b >>c >>d >>e;
	if(a < 0&&b < 0){
		cout <<(b - a)*c <<endl;
	}
	else if(a <= 0&&b>=0){
		cout <<abs(a)*c+d+b*e <<endl;
	}
	else{
		cout <<(b - a)*e<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };


struct Combination {

	vector<ll> fact, rfact;

	Combination(ll sz) : fact(sz + 1), rfact(sz + 1) {

		fact[0] = 1;
		for (ll i = 1; i < fact.size(); i++) {
			fact[i] = fact[i - 1] * i % MOD;
		}
		//逆元
		rfact[sz] = inv(fact[sz]);
		for (ll i = sz - 1; i >= 0; i--) {
			rfact[i] = rfact[i + 1] * (i + 1) % MOD;
		}
	}

	ll inv(ll x) {
		//modpow
		return pow(x, MOD - 2);
	}
	ll pow(ll x, ll n) {
		//累乗
		ll ret = 1;
		while (n > 0) {
			if (n & 1) (ret *= x) %= MOD;
			(x *= x) %= MOD;
			n >>= 1;
		}
		return (ret);
	}
	ll P(ll n, ll r) {
		//順列
		if (r < 0 || n < r) return (0);
		return (fact[n] * rfact[n - r] % MOD);
	}

	ll C(ll p, ll q) {
		//組み合わせ
		if (q < 0 || p < q) return (0);
		return (fact[p] * rfact[q] % MOD * rfact[p - q] % MOD);
	}

	ll H(ll n, ll r) {
		//重複組み合わせ
		if (n < 0 || r < 0) return (0);
		return (r == 0 ? 1 : C(n + r - 1, r));
	}
};


/******************************************************************************************/

template<typename T>
T LIS(vector<T>& a) {/*長さに対する最小の最終要素*/

	T siz = a.size();
	vector<T> dp(a.size() + 10, INF);

	for (T i = 0; i < siz; i++) {
		*lower_bound(dp.begin(), dp.begin() + siz, a[i]) = a[i];
	}
	return lower_bound(dp.begin(), dp.begin() + siz, INF) - dp.begin();
}



int main() {

	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	
	int ans = 0;
	for (int i = a; i < b; i++)
	{
		if (i < 0) {
			ans += c;
		}
		else if (i == 0) {
			ans += d;
			ans += e;
		}
		else
		{
			ans += e;
		}
	}

	cout << ans << endl;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,e,time=0,t=0;
	cin>>a>>b>>c>>d>>e;
	if(a<0)///
		for(int i=a;i<0;i++){
			t=t+c;}
		time=t+d+(b*e);
	if(a==0)///
		time=d+(b*e);
	if(a>0)///
		time=(b-a)*e;	
	cout<<time<<endl;	
	
	return 0;
}

C++: #include<cstdio>
using namespace std;
int main()
{
	int a,b,c,d,e,sum;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
	sum=0;
	if(a<0){
		a*=-1;
		sum+=c*a+d;
	}
	else{
		b-=a;
	}
	sum+=b*e;
	printf("%d\n",sum);
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
	int a, b, c, d, e, t1, t2, t3;

	cin >> a >> b >> c >> d >> e;
	if (a > 0) {
		t1 = 0;
		t2 = 0;
		t3 = b - a;
	}
	else {
		t1 = -a;
		t2 = 1;
		t3 = b;
	}
	cout << t1*c + t2*d + t3*e << endl;

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	if(a<0)
	cout<<(0-a)*c+d+b*e<<endl;
	else  
	cout<<(b-a)*e<<endl;
	return 0;
}